Bläddra i källkod

Merge branch 'master' of http://git.dgtis.com/15896567520/RuoYi-flowable-master

zjc 1 år sedan
förälder
incheckning
907e9ca3ff

+ 1 - 0
ruoyi-ui/.env.development

@@ -7,6 +7,7 @@ ENV = 'development'
 # 若依管理系统/开发环境
 VUE_APP_BASE_API = '/dev-api'
 # VUE_APP_BASE_API = '192.168.100.234:8080'
+VUE_APP_CORPID = "ding4ab75ecd53106cde4ac5d6980864d335"
 
 
 # 路由懒加载

+ 1 - 0
ruoyi-ui/.env.production

@@ -6,3 +6,4 @@ ENV = 'production'
 
 # 若依管理系统/生产环境
 VUE_APP_BASE_API = '/prod-api'
+VUE_APP_CORPID = "ding4ab75ecd53106cde4ac5d6980864d335"

+ 58 - 0
ruoyi-ui/cool.config.json

@@ -0,0 +1,58 @@
+{
+  "id": 9394,
+  "gmt_create": "2023-11-20T07:51:32.000Z",
+  "gmt_modified": "2023-11-20T07:51:32.000Z",
+  "app_name": "crm",
+  "app_type": 1,
+  "tenant": "dingone",
+  "tenant_id": "ding4ab75ecd53106cde4ac5d6980864d335",
+  "app_owner_ids": "[{\"_persist\":{\"version\":-1,\"rehydrated\":true},\"corpId\":\"ding4ab75ecd53106cde4ac5d6980864d335\",\"orgName\":\"叶子组织\",\"name\":\"陈亚美\",\"staffId\":\"304259305537628028\",\"uid\":734997255,\"permission\":{\"application\":true,\"developer\":true}}]",
+  "icon": "https://static.dingtalk.com/media/lADPNDjc01PcTWXMyMzI_200_200.jpg",
+  "app_desc": "crmcrmcrm",
+  "appkey": "dingwlimimzllguvqf8x",
+  "appsecret": "pH4lgZ_k8lgkAU9jboz0SBpybX2kpGKotzL_sg5Gu8Whd-s7n3S_5rrziiK2Hde9",
+  "web_app_info": {
+    "agentId": 2803464118,
+    "appKey": "dingwlimimzllguvqf8x",
+    "appSecret": "pH4lgZ_k8lgkAU9jboz0SBpybX2kpGKotzL_sg5Gu8Whd-s7n3S_5rrziiK2Hde9",
+    "appStatus": 1,
+    "appType": 1,
+    "canDelete": true,
+    "canUpdate": true,
+    "deleteStatus": 0,
+    "desc": "crmcrmcrm",
+    "developType": 0,
+    "gmtCreate": 1700466692000,
+    "gmtModified": 1700537331000,
+    "hidden": false,
+    "homepageLink": "http://192.168.100.94:80/",
+    "icon": "@lADPNDjc01PcTWXMyMzI",
+    "iconUrl": "https://i01.lw.aliimg.com/media/lADPNDjc01PcTWXMyMzI_200_200.jpg",
+    "id": 2803464118,
+    "ipWhiteList": [
+      "192.168.100.*"
+    ],
+    "isGraphEnabled": false,
+    "isUnifiedAppDev": true,
+    "linkGateWayPush": true,
+    "miniAppOnPc": false,
+    "name": "crm",
+    "ompLink": "http://192.168.100.94:80/",
+    "pcHomepageLink": "http://192.168.100.94:80/",
+    "publishStatus": "0",
+    "scopeSupportDynamicGroupGray": false,
+    "scopeSupportRoleGray": true,
+    "shortcut": false,
+    "sortOrder": 3200,
+    "sourceLevel": 0,
+    "timeToDel": 0,
+    "unifiedAppId": "cfd69a85-1c6b-40d5-a156-702cc88f7618",
+    "visibleScopes": [
+      {
+        "deptId": -1,
+        "name": "叶子组织"
+      }
+    ]
+  },
+  "web_app_id": 2803464118
+}

+ 4 - 0
ruoyi-ui/package.json

@@ -50,6 +50,9 @@
     "clipboard": "2.0.8",
     "core-js": "^3.33.2",
     "diagram-js": "^11.4.1",
+    "dingtalk-design-libs": "^0.2.0",
+    "dingtalk-h5-remote-debug": "^0.1.3",
+    "dingtalk-jsapi": "^3.0.29",
     "echarts": "5.4.0",
     "element-ui": "2.15.13",
     "file-drops": "^0.4.0",
@@ -63,6 +66,7 @@
     "quill": "1.3.7",
     "screenfull": "5.0.2",
     "sortablejs": "1.10.2",
+    "vconsole": "^3.15.1",
     "vkbeautify": "^0.99.3",
     "vue": "2.6.12",
     "vue-count-to": "1.0.13",

+ 1 - 0
ruoyi-ui/public/index.html

@@ -7,6 +7,7 @@
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <link rel="icon" href="<%= BASE_URL %>favicon.ico">
     <title><%= webpackConfig.name %></title>
+    <script src="https://g.alicdn.com/dingding/dingtalk-jsapi/2.0.57/dingtalk.open.js"></script>
     <!--[if lt IE 11]><script>window.location.href='/html/ie.html';</script><![endif]-->
 	  <style>
     html,

+ 1 - 1
ruoyi-ui/src/api/crmSystem/index.js

@@ -2,7 +2,7 @@ import request from '@/utils/request'
 const crmSystem = "/crmSystem"
 
 // 查询已办任务列表
-export function finishedList(query) {
+export function myTaskList(query) {
     return request({
         url: crmSystem + '/myTaskList',
         method: 'get',

+ 18 - 1
ruoyi-ui/src/api/login.js

@@ -56,4 +56,21 @@ export function getCodeImg() {
     method: 'get',
     timeout: 20000
   })
-}
+}
+
+// 钉钉免登录
+export function avoidLogin(data) {
+  return request({
+    url: '/ding/avoidLogin',
+    method: 'post',
+    data: data
+  })
+}
+// 授权登录
+export function authToken(data) {
+  return request({
+    url: '/ding/authToken2',
+    method: 'post',
+    data: data
+  })
+}

+ 2 - 2
ruoyi-ui/src/layout/components/Sidebar/index.vue

@@ -36,11 +36,11 @@
         />
       </el-menu>
     </el-scrollbar>
-    <div class="closeWrapper">
+    <!-- <div class="closeWrapper">
       <router-link :to="{name:'Home'}">
         <i class="el-icon-circle-close"></i>
       </router-link>
-    </div>
+    </div> -->
   </div>
 </template>
 

+ 3 - 1
ruoyi-ui/src/main.js

@@ -56,7 +56,9 @@ library.add(fas,)
 library.add(far)
 library.add(fab)
 Vue.component('font-awesome-icon', FontAwesomeIcon)
-
+import VConsole from "vconsole";
+const vConsole = new VConsole();
+// import * as dd from 'dingtalk-jsapi'
 // 全局方法挂载
 Vue.prototype.getDicts = getDicts
 Vue.prototype.getConfigKey = getConfigKey

+ 6 - 8
ruoyi-ui/src/views/crmSystem/customerInformation/add.vue

@@ -42,7 +42,7 @@
           </el-col>
           <el-col :span="12">
             <el-form-item label="申请公司" prop="dhrmCompanyId">
-              <el-select
+              <!-- <el-select
                 v-model="customer.dhrmCompanyId"
                 disabled
                 :style="{ width: '100%' }"
@@ -52,7 +52,7 @@
                   :label="dhrmCompany.dhrmCompanyName"
                   :value="dhrmCompany.dhrmCompanyId"
                 />
-              </el-select>
+              </el-select> -->
             </el-form-item>
           </el-col>
           <el-col :span="12">
@@ -1031,7 +1031,7 @@ export default {
     this.customer.responsibleDept = this.dept.deptId;
     this.customer.dhrmCompanyId = this.dhrmCompany.dhrmCompanyId;
     this.customer.customerCode = this.getCustomerCode();
-    console.log("customerCode=", this.customer.customerCode);
+    // console.log("customerCode=", this.customer.customerCode);
   },
   mounted() {
     // 获取最新的crm-流程id
@@ -1105,7 +1105,6 @@ export default {
     imageFileBeforeUpload() {},
     // 切换步骤
     handleStep(active) {
-      console.log("active=", active);
       this.active = active;
     },
     back() {},
@@ -1126,7 +1125,6 @@ export default {
           if (valid) {
             ++this.active;
           } else {
-            console.log("error submit!!");
             return false;
           }
         });
@@ -1144,9 +1142,9 @@ export default {
       this.$refs["addUserForm"].validate((valid) => {
         if (!valid) return;
         // 提交表单
-        console.log("addUserForm=", that.addUserForm);
+        // console.log("addUserForm=", that.addUserForm);
         that.contactsList.push(that.addUserForm);
-        console.log("contactsList=", that.contactsList);
+        // console.log("contactsList=", that.contactsList);
         that.cancel();
       });
     },
@@ -1187,7 +1185,7 @@ export default {
         upfile1 = null,
         upfile2 = null,
         upfile = [];
-      console.log("提交");
+      // console.log("提交");
       this.fileformData = new FormData();
       this.$refs.fileMap.submit();
       // 多文件提交

+ 5 - 4
ruoyi-ui/src/views/crmSystem/myTask/index.vue

@@ -239,7 +239,8 @@
 </template>
 
 <script>
-// import { listFile1,listFile2, getFile, delFile, updateFile } from "@/api/system/file";
+import { myTaskList } from "@/api/crmSystem/index";
+// import { myTaskList1,myTaskList2, getFile, delFile, updateFile } from "@/api/system/file";
 // 工作流
 import flow from "@/views/flowable/task/myProcess/detail/flow";
 import { flowXmlAndNode } from "@/api/flowable/definition";
@@ -281,7 +282,7 @@ export default {
     };
   },
   created() {
-    // this.getList();
+    this.getList();
   },
   methods: {
     // tab获取列表
@@ -295,7 +296,7 @@ export default {
     /** 查询我的代办任务列表 */
     getList1() {
       this.loading = true;
-      listFile(this.queryParams).then((response) => {
+      myTaskList(this.queryParams).then((response) => {
         this.myTaskList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -304,7 +305,7 @@ export default {
     /** 查询我的单据列表 */
     getList2() {
       this.loading = true;
-      listFile(this.queryParams).then((response) => {
+      myTaskList(this.queryParams).then((response) => {
         this.myList = response.rows;
         this.total = response.total;
         this.loading = false;

+ 209 - 88
ruoyi-ui/src/views/login.vue

@@ -1,116 +1,229 @@
 <template>
-  <div class="login">
-    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
-      <h3 class="title">若依后台管理系统</h3>
-      <el-form-item prop="username">
-        <el-input
-          v-model="loginForm.username"
-          type="text"
-          auto-complete="off"
-          placeholder="账号"
+  <div>
+    <div v-if="showLogin" class="login">
+      <el-form
+        ref="loginForm"
+        :model="loginForm"
+        :rules="loginRules"
+        class="login-form"
+      >
+        <h3 class="title">若依后台管理系统</h3>
+        <el-form-item prop="username">
+          <el-input
+            v-model="loginForm.username"
+            type="text"
+            auto-complete="off"
+            placeholder="账号"
+          >
+            <svg-icon
+              slot="prefix"
+              icon-class="user"
+              class="el-input__icon input-icon"
+            />
+          </el-input>
+        </el-form-item>
+        <el-form-item prop="password">
+          <el-input
+            v-model="loginForm.password"
+            type="password"
+            auto-complete="off"
+            placeholder="密码"
+            @keyup.enter.native="handleLogin"
+          >
+            <svg-icon
+              slot="prefix"
+              icon-class="password"
+              class="el-input__icon input-icon"
+            />
+          </el-input>
+        </el-form-item>
+        <el-form-item prop="code" v-if="captchaEnabled">
+          <el-input
+            v-model="loginForm.code"
+            auto-complete="off"
+            placeholder="验证码"
+            style="width: 63%"
+            @keyup.enter.native="handleLogin"
+          >
+            <svg-icon
+              slot="prefix"
+              icon-class="validCode"
+              class="el-input__icon input-icon"
+            />
+          </el-input>
+          <div class="login-code">
+            <img :src="codeUrl" @click="getCode" class="login-code-img" />
+          </div>
+        </el-form-item>
+        <el-checkbox
+          v-model="loginForm.rememberMe"
+          style="margin: 0px 0px 25px 0px"
+          >记住密码</el-checkbox
         >
-          <svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
-        </el-input>
-      </el-form-item>
-      <el-form-item prop="password">
-        <el-input
-          v-model="loginForm.password"
-          type="password"
-          auto-complete="off"
-          placeholder="密码"
-          @keyup.enter.native="handleLogin"
-        >
-          <svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
-        </el-input>
-      </el-form-item>
-      <el-form-item prop="code" v-if="captchaEnabled">
-        <el-input
-          v-model="loginForm.code"
-          auto-complete="off"
-          placeholder="验证码"
-          style="width: 63%"
-          @keyup.enter.native="handleLogin"
-        >
-          <svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
-        </el-input>
-        <div class="login-code">
-          <img :src="codeUrl" @click="getCode" class="login-code-img"/>
-        </div>
-      </el-form-item>
-      <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
-      <el-form-item style="width:100%;">
-        <el-button
-          :loading="loading"
-          size="medium"
-          type="primary"
-          style="width:100%;"
-          @click.native.prevent="handleLogin"
-        >
-          <span v-if="!loading">登 录</span>
-          <span v-else>登 录 中...</span>
-        </el-button>
-        <div style="float: right;" v-if="register">
-          <router-link class="link-type" :to="'/register'">立即注册</router-link>
-        </div>
-      </el-form-item>
-    </el-form>
-    <!--  底部  -->
-    <div class="el-login-footer">
-      <span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
+        <el-form-item style="width: 100%">
+          <el-button
+            :loading="loading"
+            size="medium"
+            type="primary"
+            style="width: 100%"
+            @click.native.prevent="handleLogin"
+          >
+            <span v-if="!loading">登 录</span>
+            <span v-else>登 录 中...</span>
+          </el-button>
+          <div style="float: right" v-if="register">
+            <router-link class="link-type" :to="'/register'"
+              >立即注册</router-link
+            >
+          </div>
+        </el-form-item>
+      </el-form>
+      <div class="el-login-footer">
+        <span>Copyright © 2018-2023 ruoyi.vip All Rights Reserved.</span>
+      </div>
+    </div>
+
+    <div v-else>
+      <el-button
+        type="primary"
+        plain
+        @click="handleModuleJump('myTaskIndex', 'crm', 'CRM系统')"
+      >
+        CRM系统
+      </el-button>
+      <el-button
+        type="primary"
+        plain
+        @click="handleModuleJump('Index', 'admin', '爱思系统')"
+      >
+        系统管理
+      </el-button>
     </div>
   </div>
 </template>
 
 <script>
-import { getCodeImg } from "@/api/login";
+import router from "../router";
+import store from "../store";
+import * as dd from "dingtalk-jsapi"; // 在此引入
+import { getCodeImg, avoidLogin, authToken } from "@/api/login";
 import Cookies from "js-cookie";
-import { encrypt, decrypt } from '@/utils/jsencrypt'
+import { encrypt, decrypt } from "@/utils/jsencrypt";
+import { initDingH5RemoteDebug } from "dingtalk-h5-remote-debug";
+import { openAuth } from "dingtalk-design-libs/biz/openAuth";
+import { getENV } from "dingtalk-jsapi/lib/env";
+import { compareVersion } from "dingtalk-jsapi/lib/sdk/sdkLib";
 
+const { platform, version, appType } = getENV();
+/**
+ * 判断当前app版本是否支持使用SDK
+ * @return {boolean}
+ */
+function isAuthSDKSupport() {
+  return compareVersion(version, "6.3.35");
+}
+initDingH5RemoteDebug();
 export default {
   name: "Login",
   data() {
     return {
+      showLogin: false,
       codeUrl: "",
       loginForm: {
         username: "admin",
         password: "admin123",
         rememberMe: false,
         code: "",
-        uuid: ""
+        uuid: "",
       },
       loginRules: {
         username: [
-          { required: true, trigger: "blur", message: "请输入您的账号" }
+          { required: true, trigger: "blur", message: "请输入您的账号" },
         ],
         password: [
-          { required: true, trigger: "blur", message: "请输入您的密码" }
+          { required: true, trigger: "blur", message: "请输入您的密码" },
         ],
-        code: [{ required: true, trigger: "change", message: "请输入验证码" }]
+        code: [{ required: true, trigger: "change", message: "请输入验证码" }],
       },
       loading: false,
       // 验证码开关
       captchaEnabled: true,
       // 注册开关
       register: false,
-      redirect: undefined
+      redirect: undefined,
     };
   },
   watch: {
     $route: {
-      handler: function(route) {
+      handler: function (route) {
         this.redirect = route.query && route.query.redirect;
       },
-      immediate: true
-    }
+      immediate: true,
+    },
   },
   created() {
-    this.getCode();
-    this.getCookie();
+    console.log("环境=", dd.env.platform);
+    isAuthSDKSupport();
+    // 加上判断条件
+    if (dd.env.platform !== "notInDingTalk") {
+      this.showLogin = false;
+      dd.ready(function () {
+        console.log("-------------000");
+        // 钉钉免登录认证
+        // dd.getAuthCode({
+        //   corpId: "ding4ab75ecd53106cde4ac5d6980864d335",
+        //   success: (res) => {
+        //     console.log("res=", res);
+        //     avoidLogin(res.code).then((res) => {
+        //       console.log("===avoidLogin_res=",res)
+        //     });
+        //   },
+        //   fail: (err) => {
+        //     console.log("err=", err);
+        //   },
+        //   complete: () => {},
+        // });
+        // 唤起授权
+        openAuth({
+          clientId: "dingwlimimzllguvqf8x", // 应用ID(唯一标识)
+          corpId: "ding4ab75ecd53106cde4ac5d6980864d335", // 当前组织的corpId
+          rpcScope: "Contact.User.Read",//通讯录
+          fieldScope: "Contact.User.mobile",//手机号
+          type: 0, // 0 标识授权个人信息;1 标识授权组织信息
+        }).then((res) => {
+          // 处理返回数据
+          console.log("res", res);
+          authToken(res.result.authCode).then((res) => {
+            console.log("===avoidLogin_res=", res);
+          });
+        });
+      });
+    } else {
+      this.showLogin = true;
+      this.getCode();
+      this.getCookie();
+    }
+
+    console.log("-=====login=====");
   },
   methods: {
+    handleModuleJump(name, type, title) {
+      let that = this;
+      //更改侧边栏参数及title
+      this.$store.commit("SET_SYSTEMTYPE", type);
+      this.$store.commit("SET_SYSTEMTITLE", title);
+      //生成侧边栏
+      store.dispatch("GenerateRoutes").then((accessRoutes) => {
+        console.log("accessRoutes=", accessRoutes);
+        // 根据roles权限生成可访问的路由表
+        router.addRoutes(accessRoutes); // 动态添加可访问路由表
+        that.$router.push({ name, query: { type, title } });
+      });
+    },
     getCode() {
-      getCodeImg().then(res => {
-        this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
+      getCodeImg().then((res) => {
+        this.captchaEnabled =
+          res.captchaEnabled === undefined ? true : res.captchaEnabled;
         if (this.captchaEnabled) {
           this.codeUrl = "data:image/gif;base64," + res.img;
           this.loginForm.uuid = res.uuid;
@@ -120,38 +233,46 @@ export default {
     getCookie() {
       const username = Cookies.get("username");
       const password = Cookies.get("password");
-      const rememberMe = Cookies.get('rememberMe')
+      const rememberMe = Cookies.get("rememberMe");
       this.loginForm = {
         username: username === undefined ? this.loginForm.username : username,
-        password: password === undefined ? this.loginForm.password : decrypt(password),
-        rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
+        password:
+          password === undefined ? this.loginForm.password : decrypt(password),
+        rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
       };
     },
     handleLogin() {
-      this.$refs.loginForm.validate(valid => {
+      this.$refs.loginForm.validate((valid) => {
         if (valid) {
           this.loading = true;
           if (this.loginForm.rememberMe) {
             Cookies.set("username", this.loginForm.username, { expires: 30 });
-            Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
-            Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
+            Cookies.set("password", encrypt(this.loginForm.password), {
+              expires: 30,
+            });
+            Cookies.set("rememberMe", this.loginForm.rememberMe, {
+              expires: 30,
+            });
           } else {
             Cookies.remove("username");
             Cookies.remove("password");
-            Cookies.remove('rememberMe');
+            Cookies.remove("rememberMe");
           }
-          this.$store.dispatch("Login", this.loginForm).then(() => {
-            this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
-          }).catch(() => {
-            this.loading = false;
-            if (this.captchaEnabled) {
-              this.getCode();
-            }
-          });
+          this.$store
+            .dispatch("Login", this.loginForm)
+            .then(() => {
+              this.$router.push({ path: this.redirect || "/" }).catch(() => {});
+            })
+            .catch(() => {
+              this.loading = false;
+              if (this.captchaEnabled) {
+                this.getCode();
+              }
+            });
         }
       });
-    }
-  }
+    },
+  },
 };
 </script>
 

+ 3 - 3
ruoyi-ui/src/views/redirect.vue

@@ -2,9 +2,9 @@
 export default {
   created() {
     console.log("=======redirect=====")
-    const { params, query } = this.$route
-    const { path } = params
-    this.$router.replace({ path: '/' + path, query })
+    // const { params, query } = this.$route
+    // const { path } = params
+    // this.$router.replace({ path: '/' + path, query })
   },
   render: function(h) {
     return h() // avoid warning message