pruple_boy 8 months ago
parent
commit
cdce56892e
2 changed files with 44 additions and 1 deletions
  1. 2 1
      src/main.js
  2. 42 0
      src/sample/rise.js

+ 2 - 1
src/main.js

@@ -26,6 +26,7 @@ import ding from "./vendor/dingApi"; /** @钉钉API */
 import cp from "./sample/cloudpure"
 import guyuan from "./sample/guyuan"
 import hangshi from "./sample/hangshi"
+import rise from "./sample/rise"
 
 export async function init (_this, config = {}) {
   console.log(this)
@@ -44,7 +45,7 @@ export async function init (_this, config = {}) {
   this.request = { dp, xhr, net: { crossDomainByScript } }; // 请求
   this.ding = ding;
   this.corp = {
-    cp, guyuan, hangshi
+    cp, guyuan, hangshi, rise
   }
   // 输出日志;
   const msg = `mjs load success. ♨ 访问应用: ${pageConfig.appType} ${pageConfig.appName} ©️ 版权请请联系: https://www.aliwork.com/o/mc`;

+ 42 - 0
src/sample/rise.js

@@ -0,0 +1,42 @@
+
+/*** mjs 之 瑞思 ***/
+import { KEY_NO_LOADING, KEY_SHOW_MESSAGE } from "../service/request";
+
+export default {
+
+  // 公共配置
+  init () {
+    mjs.conf.api = "https://mc.cloudpure.cn/proxy/ruisi";
+    return this; // this 指向当前项目本身
+  },
+
+  // 获取审批节点
+  approvalRecord (compId) {
+
+    const procInsId = mjs.$this.utils.router.getQuery("procInsId");
+    // 兼容矩阵更新延迟情况
+    if (procInsId && mjs.$this.$(compId).getValue().length < 3) {
+      setTimeout(async () => {
+        const rsp = await mjs.request.xhr.doPost(`${mjs.conf.api}/approval/record`, { processInstanceId: procInsId }, {
+          isUpdate: false,
+          compId
+        }, { [KEY_NO_LOADING]: true })
+        mjs.$this.$(compId).setValue(rsp.data.users); // 传递人员组件, 多选
+      }, 2000);
+    }
+  },
+
+  // 流程分享权限
+  async shareRecord (userIds = [], compId, isNotice, atUserId, content) {
+
+    userIds = userIds.map(item => item.value);
+    atUserId = atUserId.map(item => item.value).join(",")
+    const procInsId = mjs.$this.utils.router.getQuery("procInsId");
+    await mjs.request.xhr.doPost(`${mjs.conf.api}/share/record`, { processInstanceId: procInsId }, {
+      userIds, compId, isNotice, atUserId, content, userId: loginUser.userId
+    }, { [KEY_SHOW_MESSAGE]: true })
+    if (isNotice) {
+      setTimeout(() => location.reload(), 750);
+    }
+  }
+};