Преглед на файлове

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

 Conflicts:
	fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java
cs преди 2 години
родител
ревизия
632fe7f220

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -14,6 +14,7 @@ import org.apache.poi.ss.util.CellRangeAddressList;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -1015,7 +1016,7 @@ public class ProjectController {
 
     //todo 同步项目相关数据
     @RequestMapping("/synchronizationProject")
-    public HttpRespMsg synchronizationProject(String dataJson){
+    public HttpRespMsg synchronizationProject(@RequestBody String dataJson){
         return projectService.synchronizationProject(dataJson);
     }
 }

+ 57 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/WeiXinCorpController.java

@@ -197,6 +197,63 @@ public class WeiXinCorpController {
     }
 
 
+    //"获取企业微信jssdk初始化配置参数"
+    @RequestMapping("/getCorpWXAgentConfig")
+    public HttpRespMsg getCorpWXAgentConfig(String url, String token) {
+        HttpRespMsg msg = new HttpRespMsg();
+        try {
+            User user = userMapper.selectById(token);
+            WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+
+            Item item = corpTicketMap.get(wxCorpInfo.getCorpid());
+            if (item == null || item.expireTime.isBefore(LocalDateTime.now())) {
+                //重新获取
+                String getTicketUrl = "https://qyapi.weixin.qq.com/cgi-bin/ticket/get?access_token=ACCESS_TOKEN&type=agent_config";
+                String corpToken = getCorpAccessToken(wxCorpInfo);
+                getTicketUrl = getTicketUrl.replace("ACCESS_TOKEN", corpToken);
+                String forObject = this.restTemplate.getForObject(getTicketUrl, String.class);
+                JSONObject json = JSONObject.parseObject(forObject);
+                log.info("返回:"+json.toJSONString());
+                if (json.getIntValue("errcode") == 0) {
+                    String ticket = json.getString("ticket");
+                    Item it = new Item();
+                    it.expireTime = LocalDateTime.now().plusSeconds(7200);
+                    it.jsTicket = ticket;
+                    corpTicketMap.put(wxCorpInfo.getCorpid(), it);
+                    item = it;
+                }
+            }
+            if (item == null) {
+                //msg.setError("jsapiTicket获取失败");
+                msg.setError(MessageUtils.message("wx.TicketError"));
+                return msg;
+            }
+            log.info("jsTicket = " + item.jsTicket);
+            // 随机数
+            String nonce_str = Sha1Util.getNonceStr();
+            String timestamp = Sha1Util.getTimeStamp();
+            // 对以下字段进行签名
+            SortedMap<String, String> packageParams = new TreeMap<String, String>();
+            SortedMap<String, String> packageParam = new TreeMap<String, String>();
+            packageParam.put("jsapi_ticket", item.jsTicket);
+            packageParam.put("noncestr", nonce_str);
+            packageParam.put("timestamp", ""+timestamp);
+            packageParam.put("url", url);
+            String sign = Sha1Util.createSHA1Sign(packageParam);
+            packageParams.put("corpid", wxCorpInfo.getCorpid());//这里使用企业微信corpId
+            packageParams.put("agentid",String.valueOf(wxCorpInfo.getAgentid()));
+            packageParams.put("timestamp",""+timestamp);
+            packageParams.put("nonceStr",nonce_str);
+            packageParams.put("signature", sign);
+            msg.data = packageParams;
+        } catch (Exception e) {
+            e.printStackTrace();
+            msg.setError(e.getMessage());
+        }
+        return msg;
+    }
+
+
     //获取企业AccessToken
     private String getCorpAccessToken(WxCorpInfo corpInfo) throws Exception {
         if (corpInfo.getExpireTime().isBefore(LocalDateTime.now())) {

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.java

@@ -346,6 +346,9 @@ public class Project extends Model<Project> {
     @TableField(exist = false)
     private String departmentName;
 
+    @TableField(exist = false)
+    List<TaskGroup> taskGroupList;
+
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 60 - 14
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -179,6 +179,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     ThirdPartyInterfaceService thirdPartyInterfaceService;
     @Resource
     ProjectSeparateService projectSeparateService;
+    @Resource
+    TaskGroupService taskGroupService;
 
 
     @Resource
@@ -6552,6 +6554,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         JSONObject jsonObject = JSON.parseObject(dataJson);
         JSONObject header = (JSONObject) jsonObject.get("header");
         String token = String.valueOf(header.get("token"));
+        String changeType = String.valueOf(header.get("changeType"));
         List<Project> projectList = JSON.parseArray(String.valueOf(jsonObject.get("projectArrays")), Project.class);
         List<ProjectSeparate> projectSeparateList = JSON.parseArray(String.valueOf(jsonObject.get("projectSeparateArrays")), ProjectSeparate.class);
         HttpRespMsg msg=new HttpRespMsg();
@@ -6569,24 +6572,67 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         }
         List<Project> allProject = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", thirdPartyInterface.getCompanyId()));
         String message="";
-        if(projectList!=null &&projectList.size()>0){
-            List<Project> changeProjectList=new ArrayList<>();
+        List<Project> changeProjectList=new ArrayList<>();
+        List<Project> inertProjectList=new ArrayList<>();
+        List<Project> deleteProjectList=new ArrayList<>();
+        if(changeType.equals("insert_project")){
+            if(projectList!=null &&projectList.size()>0){
+                for (Project project : projectList) {
+                    Optional<Project> first = allProject.stream().filter(ap ->ap.getProjectCode()!=null&& ap.getProjectCode().equals(project.getProjectCode())).findFirst();
+                    if(first.isPresent()){
+                        continue;
+                    }
+                    project.setCompanyId(thirdPartyInterface.getCompanyId());
+                    inertProjectList.add(project);
+                }
+                if(saveBatch(inertProjectList)){
+                    message+="成功添加"+inertProjectList.size()+"条项目数据";
+                }
+                for (Project project : inertProjectList) {
+                    List<TaskGroup> taskGroupList = project.getTaskGroupList();
+                    taskGroupList.forEach(tl->tl.setProjectId(project.getId()));
+                    taskGroupService.saveBatch(taskGroupList);
+                }
+            }
+        }else if(changeType.equals("update_project")){
+            if(projectList!=null &&projectList.size()>0){
+                for (Project project : projectList) {
+                    Optional<Project> first = allProject.stream().filter(ap ->ap.getProjectCode()!=null&& ap.getProjectCode().equals(project.getProjectCode())).findFirst();
+                    if(first.isPresent()){
+                        project.setId(first.get().getId());
+                        project.setCompanyId(thirdPartyInterface.getCompanyId());
+                        changeProjectList.add(project);
+                    }else continue;
+                }
+                if(updateBatchById(changeProjectList)){
+                    message+="成功更新"+changeProjectList.size()+"条项目数据";
+                }
+                List<Integer> idList = changeProjectList.stream().map(Project::getId).collect(Collectors.toList());
+                List<TaskGroup> groupList = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>().in("project_id", idList));
+                for (Project project : changeProjectList) {
+                    List<TaskGroup> taskGroupList = project.getTaskGroupList();
+                    for (TaskGroup taskGroup : taskGroupList) {
+                        taskGroup.setProjectId(project.getId());
+                        Optional<TaskGroup> first = groupList.stream().filter(gl -> gl.getTaskGroupCode() != null && gl.getTaskGroupCode().equals(taskGroup.getTaskGroupCode())).findFirst();
+                        if(first.isPresent()){
+                            taskGroup.setId(first.get().getId());
+                        }
+                    }
+                    taskGroupService.saveOrUpdateBatch(taskGroupList);
+                }
+            }
+        }else if(changeType.equals("delete_project")){
             for (Project project : projectList) {
-                Optional<Project> first = allProject.stream().filter(ap -> ap.getProjectCode().equals(project.getProjectCode())).findFirst();
+                Optional<Project> first = allProject.stream().filter(ap ->ap.getProjectCode()!=null&& ap.getProjectCode().equals(project.getProjectCode())).findFirst();
                 if(first.isPresent()){
                     project.setId(first.get().getId());
-                    changeProjectList.add(project);
+                    deleteProjectList.add(project);
+                }else continue;
+                List<Integer> idList = deleteProjectList.stream().map(Project::getId).collect(Collectors.toList());
+                if(removeByIds(idList)){
+                    message+="成功删除"+idList.size()+"条项目数据";
                 }
-            }
-            if(updateBatchById(changeProjectList)){
-                //message+="成功更新"+changeProjectList.size()+"条项目数据";
-                message+=MessageUtils.message("project.upDataSuc",changeProjectList.size());
-            }
-        }
-        if(projectSeparateList!=null&&projectSeparateList.size()>0){
-            if(projectSeparateService.updateBatchById(projectSeparateList)){
-                //message+="成功更新"+projectSeparateList.size()+"条项目子表数据";
-                message+=MessageUtils.message("project.upSonSuc",projectSeparateList.size());
+                taskGroupMapper.delete(new QueryWrapper<TaskGroup>().in("project_id",idList));
             }
         }
         msg.data=message;

+ 110 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -6,10 +6,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.injector.methods.SelectById;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
-import com.management.platform.service.CompanyDingdingService;
-import com.management.platform.service.DingDingService;
-import com.management.platform.service.ThirdPartyInterfaceService;
-import com.management.platform.service.WxCorpInfoService;
+import com.management.platform.service.*;
+import com.management.platform.util.DockWithMLD;
+import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.RedisUtil;
 import com.management.platform.util.WorkDayCalculateUtils;
 import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
@@ -32,11 +31,9 @@ import org.springframework.web.client.RestTemplate;
 import javax.annotation.Resource;
 import java.security.SecureRandom;
 import java.text.DecimalFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.Period;
+import java.time.*;
 import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAccessor;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -107,6 +104,12 @@ public class TimingTask {
     private ThirdPartyInterfaceMapper thirdPartyInterfaceMapper;
     @Resource
     private ThirdPartyInterfaceService thirdPartyInterfaceService;
+    @Resource
+    private UserFvTimeService userFvTimeService;
+    @Resource
+    private LeaveSheetService leaveSheetService;
+    @Resource
+    private BusinessTripService businessTripService;
 
     private static final List<Integer> VALID_TOKEN_CHARS = new ArrayList<>();
     static {
@@ -186,6 +189,104 @@ public class TimingTask {
         }
     }
 
+    //每天2:11 同步钉钉用户前2天到未来30天时间段的打卡,请假,出差数据
+    @Scheduled(cron = "0 30 2 ? * *")
+    private void synFanWeiWorkData() {
+        if (isDev) return;
+        List<TimeType> timeTypeList = timeTypeMapper.selectList(new QueryWrapper<TimeType>().eq("sync_fanwei", 1));
+        List<Integer> compIds = timeTypeList.stream().map(TimeType::getCompanyId).collect(Collectors.toList());
+        if(compIds.size()<0){
+            return;
+        }
+        DockWithMLD dockWithMLD=new DockWithMLD();
+        JSONObject jsonObject=new JSONObject();
+        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        DateTimeFormatter dtf1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        DateTimeFormatter dtf2 = DateTimeFormatter.ofPattern("HH:mm:ss");
+        LocalDateTime yesterday = LocalDateTime.now().minusDays(2);
+        String startDate = dtf.format(yesterday);
+        String endDate = dtf.format(yesterday.plusDays(32));
+        jsonObject.put("startDate",startDate);
+        jsonObject.put("endDate",endDate);
+        String jsonString = jsonObject.toJSONString();
+        List<UserFvTime> userFvTimeList=new ArrayList<>();
+        List<LeaveSheet> leaveSheetList=new ArrayList<>();
+        List<BusinessTrip> businessTripList=new ArrayList<>();
+        //Todo: 获取打卡数据
+        HttpRespMsg workDataMsg = dockWithMLD.getResult("http://10.1.10.41:20170/api/cube/restful/interface/getModeDataPageList/getWorkData", jsonString);
+        List<Map<String,Object>> workDataList= (List<Map<String, Object>>) workDataMsg.data;
+        for (Map<String, Object> map : workDataList) {
+            UserFvTime userFvTime=new UserFvTime();
+            User user = userMapper.selectOne(new QueryWrapper<User>().eq("job_number", map.get("userId")));
+            if(user==null){
+                continue;
+            }
+            if(compIds.contains(user.getCompanyId())){
+                userFvTime.setWorkDate((LocalDate) map.get("workDate"));
+                LocalTime startTime = LocalTime.parse(String.valueOf(map.get("startTime")), dtf2);
+                LocalTime endTime = LocalTime.parse(String.valueOf(map.get("startTime")), dtf2);
+                Duration between = Duration.between(startTime, endTime);
+                userFvTime.setStartTime((String) map.get("startTime"));
+                userFvTime.setEndTime((String) map.get("endTime"));
+                userFvTime.setCompanyId(user.getCompanyId());
+                userFvTime.setUserId(user.getId());
+                userFvTime.setWorkHours((float) between.toHours());
+                userFvTimeList.add(userFvTime);
+            }
+        }
+        userFvTimeService.saveBatch(userFvTimeList);
+        //Todo: 获取请假数据
+        HttpRespMsg leaveRecordMsg = dockWithMLD.getResult("http://10.1.10.41:20170/api/cube/restful/interface/getModeDataPageList/getLeaveRecord", jsonString);
+        List<Map<String,Object>> leaveRecordList= (List<Map<String, Object>>) leaveRecordMsg.data;
+        for (Map<String, Object> map : leaveRecordList) {
+            User user = userMapper.selectOne(new QueryWrapper<User>().eq("job_number", map.get("userId")));
+            if(user==null){
+                continue;
+            }
+            if(compIds.contains(user.getCompanyId())){
+               LeaveSheet leaveSheet=new LeaveSheet();
+               leaveSheet.setCompanyId(user.getCompanyId());
+               leaveSheet.setStatus(0);
+               leaveSheet.setOwnerId(user.getId());
+               leaveSheet.setOwnerName(user.getName());
+               leaveSheet.setStartDate(LocalDate.parse(String.valueOf(map.get("startDate")),dtf));
+               leaveSheet.setEndDate(LocalDate.parse(String.valueOf(map.get("endDate")),dtf));
+               leaveSheet.setTimeType(Integer.parseInt(String.valueOf(map.get("timeType"))));
+               leaveSheet.setTimeDays((Float) map.get("timeDays"));
+               leaveSheet.setTimeHours((Float) map.get("timeHours"));
+               leaveSheet.setLeaveType(Integer.parseInt(String.valueOf(map.get("leaveType"))));
+               leaveSheet.setProcinstId(String.valueOf(map.get("procinstId")));
+               leaveSheet.setGmtFinished(String.valueOf(map.get("gmtFinished")));
+               leaveSheetList.add(leaveSheet);
+            }
+        }
+        leaveSheetService.saveBatch(leaveSheetList);
+        //Todo: 获取出差数据
+        HttpRespMsg travelRecordMsg = dockWithMLD.getResult("http://10.1.10.41:20170/api/cube/restful/interface/getModeDataPageList/getTravelRecord", jsonString);
+        List<Map<String,Object>> travelRecordList= (List<Map<String, Object>>) travelRecordMsg.data;
+        for (Map<String, Object> map : travelRecordList) {
+            User user = userMapper.selectOne(new QueryWrapper<User>().eq("job_number", map.get("userId")));
+            if(user==null){
+                continue;
+            }
+            if(compIds.contains(user.getCompanyId())){
+                BusinessTrip businessTrip=new BusinessTrip();
+                businessTrip.setCompanyId(user.getCompanyId());
+                businessTrip.setStartDate(LocalDate.parse(String.valueOf(map.get("startDate")),dtf));
+                businessTrip.setEndDate(LocalDate.parse(String.valueOf(map.get("endDate")),dtf));
+                businessTrip.setWay(Integer.valueOf(String.valueOf(map.get("way"))));
+                businessTrip.setCityFrom((String) map.get("cityFrom"));
+                businessTrip.setCityTo((String) map.get("cityTo"));
+                businessTrip.setGoBack(Integer.valueOf(String.valueOf(map.get("goBack"))));
+                businessTrip.setDayCount(Integer.valueOf(String.valueOf(map.get("dayCount"))));
+                businessTrip.setProcinstId((String) map.get("procinstId"));
+                businessTrip.setGmtFinished((String)map.get("gmtFinished"));
+                businessTripList.add(businessTrip);
+            }
+        }
+        businessTripService.saveBatch(businessTripList);
+    }
+
     //每天1:00 同步昨天的微信请假信息
     @Scheduled(cron = "0 0 1 ? * *")
     private void synWxLeave() throws Exception {
@@ -314,6 +415,7 @@ public class TimingTask {
     @Scheduled(fixedRate = 1800 * 1000)
     public void  pushToken(){
         if(isDev) return;
+        if(isPrivateDeploy)return;
         int passwordLength = 30;
         LocalDateTime localDateTime=LocalDateTime.now();
         List<ThirdPartyInterface> thirdPartyInterfaceList = thirdPartyInterfaceMapper.selectList(null);

+ 3 - 0
fhKeeper/formulahousekeeper/timesheet/index.html

@@ -108,5 +108,8 @@
         <script src="https://cdn.staticfile.org/element-ui/2.13.0/index.js"></script>
         <!-- 引入echarts -->
         <script src="https://cdn.staticfile.org/echarts/3.8.5/echarts.min.js"></script>
+        <!-- 引入企业微信js -->
+        <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js" referrerpolicy="origin"></script>
+        <script src="https://open.work.weixin.qq.com/wwopen/js/jwxwork-1.0.0.js" referrerpolicy="origin"></script>
     </body>
 </html>

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/i18n/en.json

@@ -1390,5 +1390,6 @@
   "shan-chu-ji-lu": "Delete Record",
   "wanttodeletefirst": "Please select the record to delete first",
   "xuan-ze": "choose",
-  "dui-yi-you-xiang-mu-jin-hang-xin-xi-geng-xin": "Update information on existing projects"
+  "dui-yi-you-xiang-mu-jin-hang-xin-xi-geng-xin": "Update information on existing projects",
+  "dao-chu-qing-jia-dan": "Export leave request"
 }

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/i18n/zh.json

@@ -1390,5 +1390,6 @@
   "profitratetrendchart": "利润率趋势图",
   "li-run-shuai": "利润率(%)",
   "bai-fen-bi": "百分比",
-  "dui-yi-you-xiang-mu-jin-hang-xin-xi-geng-xin": "对已有项目进行信息更新"
+  "dui-yi-you-xiang-mu-jin-hang-xin-xi-geng-xin": "对已有项目进行信息更新",
+  "dao-chu-qing-jia-dan": "导出请假单"
 }

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

@@ -209,7 +209,7 @@
                 <el-date-picker v-model="createDate" type="daterange" :range-separator="$t('other.to')" :start-placeholder="$t('time.startDate')" :end-placeholder="$t('time.endDate')" @change="chufas()" value-format="yyyy-MM-dd" :placeholder="$t('optiondate')" size="small" clearable style="width:280px"></el-date-picker>
             </div>
             <div>
-              <el-button type="primary" size="small" style="margin-left:20px" @click="exportLeave()">导出请假单</el-button>
+              <el-button type="primary" size="small" style="margin-left:20px" @click="exportLeave()">{{ $t('dao-chu-qing-jia-dan') }}</el-button>
             </div>
           </div>
             <el-table v-loading="loading" :data="tableData" style="width: 100%" height="94%">

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -389,7 +389,7 @@
                 <el-form-item :label="$t('projectclassification')" v-if="user.timeType.mainProjectState != '1'">
                     <!-- <el-select v-model="addForm.category"  style="width:32%;" clearable :disabled="!permissions.projectManagement && addForm.creatorId != user.id"> -->
                     <el-select v-model="addForm.category"  style="width:32%;" clearable>
-                        <el-option v-for="(item) in baseClfList" :key="item.id" :value="item.id" ::label="item.name"></el-option>
+                        <el-option v-for="(item) in baseClfList" :key="item.id" :value="item.id" :label="item.name"></el-option>
                     </el-select>
                 </el-form-item>
                 <el-form-item :label="$t('headerTop.projectName')" prop="name">

+ 71 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -11,6 +11,7 @@
                   </div>
             </div>
             <el-divider style="margin: 0px 0px !important;height:0.5px;"></el-divider>
+            <div v-if="user.companyId == '1081'">{{tixtass}}</div>
             <div class="tree" :style="'height:'+ (tableHeight + 83) + 'px'">
                 <!-- <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" accordion></el-tree> -->
                 <!-- <el-tree :data="data" :props="defaultProps" node-key="id" :expand-on-click-node="false" accordion @node-click="handleNodeClick" :default-expanded-keys="jDarr" @node-expand="jieDian" @node-collapse="shutDown" @current-change="chufa"> -->
@@ -677,6 +678,7 @@ export default {
   },
   data() {
     return {
+      tixtass: '变化',
       syncMembByCardTimeResultGialog:false,
       syncMembByCardTimeMsg:null,
       editSecret: false,
@@ -2974,6 +2976,71 @@ export default {
             }
           );
     },
+    // 获取企业微信的参数
+    agentConfig() {
+       var curUrl = location.href.split("#")[0];
+       this.http.post("/wxcorp/getCorpWXConfig", {url: curUrl, token: this.user.id}, (res) => {
+          if (res.code == "ok") {
+            this.tixtass = "config,进入"
+            wx.config({ 
+              beta: true,
+              debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+              appId: res.data.appid, // 必填,公众号的唯一标识 
+              timestamp: res.data.timestamp, // 必填,生成签名的时间戳 
+              nonceStr: res.data.noncestr, // 必填,生成签名的随机串 
+              signature: res.data.sign, // 必填,签名,见附录1 
+              jsApiList: ['chooseImage','previewImage','uploadImage','downloadImage','previewFile','getLocation','agentConfig'] 
+            });
+              var that = this;
+              wx.ready(function(){
+                  // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
+                  // if (that.user.companyId == 7) {
+                  //     that.$toast('wx init success==7 ');
+                  //     that.getLocation();
+                  // }
+                  that.getagentConfigs() 
+              });
+          }
+       }, (error) => {
+          console.log(error, '哦耶')
+       })
+    },
+    getagentConfigs() {
+          this.tixtass = "进了"
+      var curUrl = location.href.split("#")[0];
+       this.http.post("/wxcorp/getCorpWXAgentConfig", {url: curUrl, token: this.user.id}, (res) => {
+          if (res.code == "ok") {
+          this.tixtass = "处理"
+          console.log()
+            wx.agentConfig({
+                corpid: res.data.corpid, // 必填,企业微信的corpid,必须与当前登录的企业一致
+                agentid: res.data.agentid, // 必填,企业微信的应用id (e.g. 1000247)
+                timestamp: res.data.timestamp, // 必填,生成签名的时间戳
+                nonceStr: res.data.nonceStr, // 必填,生成签名的随机串
+                signature: res.data.signature, // 必填,签名,见附录-JS-SDK使用权限签名算法
+                jsApiList: ['selectExternalContact'], //必填,传入需要使用的接口名称
+                success: function (result) {
+                    console.log(result, '请求微信成功')
+                    this.tixtass = '注入'
+                    //  wx.agentConfig成功回调后,WWOpenData 才会注入到 window 对象上面
+                    window.WWOpenData.bind(document.querySelector('ww-open-data'))
+                },
+                fail: function (res) {
+                    console.log('查看错误信息', res)
+                    if (res.errMsg.indexOf('function not exist') > -1) {
+                        alert('版本过低请升级')
+                    }
+                },
+            })
+          }
+       }, (error) => {
+          console.log('查看错误信息' + res)
+          this.tixtass = "失败"
+          if (error.errMsg.indexOf('function not exist') > -1) {
+              alert('版本过低请升级')
+          }
+       })
+    }
   },
   mounted() {
     this.deactiveDate = util.formatDate.format(new Date(), "yyyy-MM-dd");
@@ -2984,6 +3051,10 @@ export default {
     this.acquireRole();
     this.getProfessional();
     this.getStaffCountMax();
+    // 获取企业微信的参数
+    if(this.user.companyId = '1081') {
+      this.agentConfig()
+    }
   },
 };
 </script>

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -106,7 +106,7 @@
                         <van-stepper v-model="pItem.progress" integer min="0" max="100" />%
                     </template>
                     </van-field>
-                    <van-field v-if="user.company.packageProject == 1"  readonly name="taskId" :value="item.taskName" label="关联任务" placeholder="请选择关联任务" @click="clickPickerTask(index,item)"
+                    <van-field v-if="user.company.packageProject == 1"  readonly name="taskId" :value="item.taskName" label="任务/里程碑" placeholder="请选择任务/里程碑" @click="clickPickerTask(index,item)"
                     ></van-field>
                     <van-field name="taskFinish" label="是否已完成" v-if="item.taskId != null">
                         <template #input>