检查表手动添加检查项时根据部门类型展示不一样

This commit is contained in:
王利强
2026-08-03 11:51:07 +08:00
parent 088ff356f2
commit ec76d588e2
50 changed files with 826 additions and 428 deletions

View File

@@ -1 +1 @@
"use strict";const e=require("../common/vendor.js");function t(e){if(!e)return null;if("string"==typeof e)try{return JSON.parse(e)}catch(t){return null}return e}function n(){try{const n=e.index.getStorageSync("currentIdentity");return n?t(n):null}catch(n){return null}}function r(e){return null==e||""===e?"":String(e).trim()}function o(e){if(!e)return"";const o=t(e.userIdentity),i=n(),u=r(null==o?void 0:o.roleKey);if(u)return u;const l=r(null==i?void 0:i.roleKey);if(l)return l;const d=r(e.role);if(d)return d;const a=[null==o?void 0:o.roleName,null==o?void 0:o.identityName,e.identityName,null==i?void 0:i.roleName,null==i?void 0:i.identityName].filter(Boolean).join(" ");return/审批|approval/i.test(a)?"approval":""}function i(e,n){const r=n||t(null==e?void 0:e.userIdentity);if(null==r?void 0:r.identityName)return r.identityName;if(null==e?void 0:e.identityName)return e.identityName;if(r){const e=[r.deptName,r.roleName,r.postName].filter(Boolean);if(e.length)return e.join("-")}return""}function u(e){if(!e)return{};const o=t(e.userIdentity),u=n(),l=r((null==o?void 0:o.roleKey)||(null==u?void 0:u.roleKey)||function(e,t=""){if(!(null==e?void 0:e.length))return r(t);const n=e[0];return r("string"==typeof n?n:n.roleKey||n.role||t)}(e.roles,""));return{userId:e.userId||"",username:e.userName||"",nickName:e.nickName||"",deptId:(null==o?void 0:o.deptId)??(null==u?void 0:u.deptId)??e.deptId??"",deptName:(null==o?void 0:o.deptName)??(null==u?void 0:u.deptName)??e.deptName??"",role:l,avatar:e.avatar||"",phone:e.phonenumber||e.phone||"",identityName:i(e,o),userIdentity:o||u}}exports.applyProfileToUserInfo=function(t,n){const r=u(n);return Object.keys(r).forEach((e=>{t[e]=r[e]})),e.index.setStorageSync("userInfo",JSON.stringify(r)),r},exports.applyStoredUserInfo=function(e,r){if(!r)return;const u=t(r.userIdentity),l=n(),d=u||l,a={userId:r.userId||"",username:r.username||"",nickName:r.nickName||"",deptId:r.deptId||(null==d?void 0:d.deptId)||"",deptName:r.deptName||(null==d?void 0:d.deptName)||"",role:o({role:r.role,userIdentity:d,identityName:r.identityName}),avatar:r.avatar||"",phone:r.phone||"",userIdentity:d,identityName:r.identityName||i(r,d)};return Object.keys(a).forEach((t=>{e[t]=a[t]})),a},exports.resolveIdentityName=i,exports.resolveUserRoleKey=o,exports.saveUserInfoToStorage=function(t){const n=u(t);return e.index.setStorageSync("userInfo",JSON.stringify(n)),n};
"use strict";const e=require("../common/vendor.js");function t(e){if(!e)return null;if("string"==typeof e)try{return JSON.parse(e)}catch(t){return null}return e}function n(){try{const n=e.index.getStorageSync("currentIdentity");return n?t(n):null}catch(n){return null}}function r(e){return null==e||""===e?"":String(e).trim()}function i(e){if(!e)return"";const i=t(e.userIdentity),o=n(),u=r(null==i?void 0:i.roleKey);if(u)return u;const l=r(null==o?void 0:o.roleKey);if(l)return l;const d=r(e.role);if(d)return d;const a=[null==i?void 0:i.roleName,null==i?void 0:i.identityName,e.identityName,null==o?void 0:o.roleName,null==o?void 0:o.identityName].filter(Boolean).join(" ");return/审批|approval/i.test(a)?"approval":""}function o(e,n){const r=n||t(null==e?void 0:e.userIdentity);if(null==r?void 0:r.identityName)return r.identityName;if(null==e?void 0:e.identityName)return e.identityName;if(r){const e=[r.deptName,r.roleName,r.postName].filter(Boolean);if(e.length)return e.join("-")}return""}function u(e){if(!e)return{};const i=t(e.userIdentity),u=n(),l=r((null==i?void 0:i.roleKey)||(null==u?void 0:u.roleKey)||function(e,t=""){if(!(null==e?void 0:e.length))return r(t);const n=e[0];return r("string"==typeof n?n:n.roleKey||n.role||t)}(e.roles,""));return{userId:e.userId||"",username:e.userName||"",nickName:e.nickName||"",deptId:(null==i?void 0:i.deptId)??(null==u?void 0:u.deptId)??e.deptId??"",deptName:(null==i?void 0:i.deptName)??(null==u?void 0:u.deptName)??e.deptName??"",role:l,avatar:e.avatar||"",phone:e.phonenumber||e.phone||"",identityName:o(e,i),userIdentity:i||u}}exports.applyProfileToUserInfo=function(t,n){const r=u(n);return Object.keys(r).forEach((e=>{t[e]=r[e]})),e.index.setStorageSync("userInfo",JSON.stringify(r)),r},exports.applyStoredUserInfo=function(e,r){if(!r)return;const u=t(r.userIdentity),l=n(),d=u||l,a={userId:r.userId||"",username:r.username||"",nickName:r.nickName||"",deptId:r.deptId||(null==d?void 0:d.deptId)||"",deptName:r.deptName||(null==d?void 0:d.deptName)||"",role:i({role:r.role,userIdentity:d,identityName:r.identityName}),avatar:r.avatar||"",phone:r.phone||"",userIdentity:d,identityName:r.identityName||o(r,d)};return Object.keys(a).forEach((t=>{e[t]=a[t]})),a},exports.resolveIdentityName=o,exports.resolveUserIdentityRoleKey=function(e){if(!e)return"";const n=t(e.userIdentity);return r(null==n?void 0:n.roleKey)},exports.saveUserInfoToStorage=function(t){const n=u(t);return e.index.setStorageSync("userInfo",JSON.stringify(n)),n};