Browse Source

4.0.72 审批增加授权资源

liuyanpeng 1 year ago
parent
commit
22d7fcdf44

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-base-v4",
   "description": "Leanwo Prodog Client",
-  "version": "4.0.71",
+  "version": "4.0.72",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 1 - 1
src/App.vue

@@ -20,8 +20,8 @@
             <div>
               <keep-alive>
                 <MenuWidget :width="width" />
-                <div class="resize-handle" @mousedown="handleMouseDown" />
               </keep-alive>
+              <div class="resize-handle" @mousedown="handleMouseDown" />
             </div>
           </div>
         </div>

+ 43 - 0
src/api/authorization/index.js

@@ -0,0 +1,43 @@
+import Common from '../../common/Common';
+
+// 查询授权资源
+export const queryAuth = params => {
+  const requestUrl = `AuthSettingResource/queryAuthorization?windowNo=${params.windowNo}&recordId=${params.recordId}&userId=${params.userId}`;
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};
+
+// 新增授权资源
+export const addAuth = params => {
+  const requestUrl = `AuthSettingResource/addAuthorization?windowNo=${params.windowNo}&recordId=${params.recordId}&userId=${params.userId}`;
+  return new Promise((resolve, reject) => {
+    $.ajax({
+      url: Common.getApiURL(requestUrl),
+      type: 'post',
+
+      beforeSend: function (request) {
+        Common.addTokenToRequest(request);
+      },
+      success: function (data) {
+        resolve(data);
+      },
+      error: function (XMLHttpRequest, textStatus, errorThrown) {
+        reject(XMLHttpRequest);
+      },
+    });
+  });
+};

+ 40 - 2
src/workflow/ApprovedWorkflow.vue

@@ -78,6 +78,7 @@ import TaskOpenUtil from './TaskOpenUtil.js';
 import WindowService from '../common/WindowService.js';
 import CustomerTask from './CustomerTask.vue';
 import { Notify } from 'pc-component-v3';
+import { queryAuth, addAuth } from '../api/authorization/index.js';
 
 const emit = defineEmits(['refreshStasticCount']);
 const customerTask = ref(null);
@@ -173,8 +174,8 @@ const searchApprove = (params, isSearch) => {
   );
 };
 
-// 选择了taskInfo
-const selectTaskInfo = taskInfo => {
+// 跳转到审批页
+const goWindow = taskInfo => {
   TaskOpenUtil.openHistoryTask(taskInfo).then(
     successData => {
       if (successData.type === 'newWindow') {
@@ -198,6 +199,43 @@ const selectTaskInfo = taskInfo => {
   );
 };
 
+// 选择了taskInfo 先查询授权资源
+const selectTaskInfo = taskInfo => {
+  const params = {
+    userId: JSON.parse(localStorage.getItem('#LoginInfo')).userId,
+    recordId: taskInfo.recordId,
+    windowNo: taskInfo.windowNo,
+  };
+  queryAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        addAuthorization(params, taskInfo);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
+// 增加授权资源
+const addAuthorization = (params, taskInfo) => {
+  addAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
 // 处理content json
 const parseContent = content => {
   const x = content;

+ 41 - 2
src/workflow/CopyTaskWorkflow.vue

@@ -86,6 +86,8 @@ import TaskOpenUtil from './TaskOpenUtil.js';
 import WindowService from '../common/WindowService.js';
 import CustomerTask from './CustomerTask.vue';
 import { Notify } from 'pc-component-v3';
+import { queryAuth, addAuth } from '../api/authorization/index.js';
+
 
 const emit = defineEmits(['refreshStasticCount']);
 const customerTask = ref(null);
@@ -198,8 +200,8 @@ const searchApprove = (params, isSearch) => {
   );
 };
 
-// 选择了taskInfo
-const selectTaskInfo = taskInfo => {
+// 调整审批页
+const goWindow = taskInfo => {
   
   if (taskInfo.systemProcess == undefined || taskInfo.systemProcess == false) {
     isLoading.value = true;
@@ -248,6 +250,43 @@ const selectTaskInfo = taskInfo => {
   );
 };
 
+// 选择了taskInfo 先查询授权资源
+const selectTaskInfo = taskInfo => {
+  const params = {
+    userId: JSON.parse(localStorage.getItem('#LoginInfo')).userId,
+    recordId: taskInfo.recordId,
+    windowNo: taskInfo.windowNo,
+  };
+  queryAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        addAuthorization(params, taskInfo);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
+// 增加授权资源
+const addAuthorization = (params, taskInfo) => {
+  addAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
 // 处理content json
 const parseContent = content => {
   const x = content;

+ 40 - 2
src/workflow/MyApplyWorkflow.vue

@@ -64,6 +64,7 @@ import { message } from 'ant-design-vue';
 import { approvedColumns } from './configData.js';
 import CustomerTask from './CustomerTask.vue';
 import { Uuid } from 'pc-component-v3';
+import { queryAuth, addAuth } from '../api/authorization/index.js';
 
 const emit = defineEmits(['refreshStasticCount']);
 const customerTask = ref(null);
@@ -156,8 +157,8 @@ const searchApprove = (params, isSearch) => {
   );
 };
 
-// 选择了taskInfo
-const selectTaskInfo = taskInfo => {
+// 跳到审批页
+const goWindow = taskInfo => {
   const type = 'view';
   const windowNo = taskInfo.windowNo;
   const tabIndex = taskInfo.tabIndex;
@@ -179,6 +180,43 @@ const selectTaskInfo = taskInfo => {
   window.open(Common.getRedirectUrl('#' + url));
 };
 
+// 选择了taskInfo 先查询授权资源
+const selectTaskInfo = taskInfo => {
+  const params = {
+    userId: JSON.parse(localStorage.getItem('#LoginInfo')).userId,
+    recordId: taskInfo.recordId,
+    windowNo: taskInfo.windowNo,
+  };
+  queryAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        addAuthorization(params, taskInfo);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
+// 增加授权资源
+const addAuthorization = (params, taskInfo) => {
+  addAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
 // 处理content json
 const parseContent = content => {
   const x = content;

+ 41 - 3
src/workflow/NeedApproveWorkflow.vue

@@ -6,7 +6,7 @@
         :placeholder="$t('lang.NeedApproveWorkflow.describe1')"
         enter-button="搜索"
         allow-clear
-        style="width: 300px;"
+        style="width: 300px"
         @search="searchDatas"
       />
     </a-col>
@@ -66,6 +66,7 @@ import TaskOpenUtil from './TaskOpenUtil.js';
 import WindowService from '../common/WindowService.js';
 import CustomerTask from './CustomerTask.vue';
 import { Notify } from 'pc-component-v3';
+import { queryAuth, addAuth } from '../api/authorization/index.js';
 
 const emit = defineEmits(['refreshStasticCount']);
 const total = ref(0);
@@ -140,8 +141,8 @@ const searchApprove = params => {
   );
 };
 
-// 选择了taskInfo
-const selectTaskInfo = taskInfo => {
+// 跳转到审批页
+const goWindow = taskInfo => {
   TaskOpenUtil.openTask(taskInfo).then(
     successData => {
       if (successData.type === 'newWindow') {
@@ -165,6 +166,43 @@ const selectTaskInfo = taskInfo => {
   );
 };
 
+// 选择了taskInfo 先查询授权资源
+const selectTaskInfo = taskInfo => {
+  const params = {
+    userId: JSON.parse(localStorage.getItem('#LoginInfo')).userId,
+    recordId: taskInfo.recordId,
+    windowNo: taskInfo.windowNo,
+  };
+  queryAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        addAuthorization(params, taskInfo);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
+// 增加授权资源
+const addAuthorization = (params, taskInfo) => {
+  addAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
 // 处理content json
 const parseContent = content => {
   const x = content;

+ 40 - 2
src/workflow/NotApproveWorkflow.vue

@@ -64,6 +64,7 @@ import { message } from 'ant-design-vue';
 import { approvedColumns } from './configData.js';
 import CustomerTask from './CustomerTask.vue';
 import { Uuid } from 'pc-component-v3';
+import { queryAuth, addAuth } from '../api/authorization/index.js';
 
 const emit = defineEmits(['refreshStasticCount']);
 const customerTask = ref(null);
@@ -156,8 +157,8 @@ const searchApprove = (params, isSearch) => {
   );
 };
 
-// 选择了taskInfo
-const selectTaskInfo = taskInfo => {
+// 跳转到审批页
+const goWindow = taskInfo => {
   const type = 'view';
   const windowNo = taskInfo.windowNo;
   const tabIndex = taskInfo.tabIndex;
@@ -179,6 +180,43 @@ const selectTaskInfo = taskInfo => {
   window.open(Common.getRedirectUrl('#' + url));
 };
 
+// 选择了taskInfo 先查询授权资源
+const selectTaskInfo = taskInfo => {
+  const params = {
+    userId: JSON.parse(localStorage.getItem('#LoginInfo')).userId,
+    recordId: taskInfo.recordId,
+    windowNo: taskInfo.windowNo,
+  };
+  queryAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        addAuthorization(params, taskInfo);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
+// 增加授权资源
+const addAuthorization = (params, taskInfo) => {
+  addAuth(params).then(
+    success => {
+      if (success.errorCode === 0) {
+        goWindow(taskInfo);
+      } else {
+        message.warning(success.errorMessage);
+      }
+    },
+    err => {
+      Common.processException(err);
+    },
+  );
+};
+
 // 处理content json
 const parseContent = content => {
   const x = content;