inl-ui 0.0.19 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.cjs +43 -0
- package/dist/components/index.d.ts +20 -0
- package/dist/components/index.js +38 -0
- package/dist/directives/index.cjs +74 -0
- package/dist/directives/index.d.ts +15 -0
- package/dist/directives/index.js +69 -0
- package/dist/hooks/index.cjs +133 -0
- package/dist/hooks/index.d.ts +50 -0
- package/dist/hooks/index.js +121 -0
- package/dist/iconfont.js +69 -0
- package/dist/index.cjs +435 -0
- package/dist/index.d.ts +177 -0
- package/dist/index.js +203 -1102
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -0
- package/dist/src/api/thingModel.d.ts +1 -0
- package/dist/src/pageComponent/views/systemManager/orgManager/depManager/batchImportModal.d.ts +20 -0
- package/dist/utils/index.cjs +181 -0
- package/dist/utils/index.d.ts +72 -0
- package/dist/utils/index.js +167 -0
- package/package.json +3 -3
- package/src/api/thingModel.ts +14 -1
- package/src/pageComponent/views/systemManager/orgManager/depManager/batchImportModal.tsx +120 -0
- package/src/pageComponent/views/systemManager/orgManager/depManager/employeeTable.tsx +38 -1
- package/src/pageComponent/views/thingModel/index.tsx +52 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var root=function(h,M,w,i,B,z,E,P,D,j){"use strict";function v(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var L=v(M),O=v(w),q=v(B),U=v(E),R=v(D),T="0.1.0-rc.13";const A=e=>{e==="dark"?(document.getElementsByTagName("html")[0].setAttribute("data-doc-theme","dark"),document.getElementsByTagName("body")[0].setAttribute("data-theme","dark"),document.getElementsByTagName("html")[0].style.colorScheme="dark"):(document.getElementsByTagName("html")[0].setAttribute("data-doc-theme","light"),document.getElementsByTagName("body")[0].setAttribute("data-theme","light"),document.getElementsByTagName("html")[0].style.colorScheme="light")};var V={set(e){window.localStorage.setItem("theme",e),A(e)},settingTheme(e){const n=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";e=e||window.localStorage.getItem("theme")||n,A(e)}};const W=e=>{const n=e.fontSize||14,t=e.designSize||1920,r=document.documentElement.clientWidth/t;document.documentElement.style.fontSize=`${n*Math.min(r,2)}px`},y=w.qiankunWindow.__POWERED_BY_QIANKUN__,Q=(e,n)=>{if(y){let t=function(u){for(const o of u)o.path=`/${e}${o.path}`,o.children?.length&&t(o.children)};const r=n.filter(u=>u.name!=="login"&&u.path!=="/login");return t(n),r.push({path:"/:pathMatch(.*)*",component:{render:()=>""}}),r}return n};function G(e){return L.default(e,{useDevMode:!0})}function H(e,n,t){let r;const u=(o={})=>{const{container:d}=o,f=d?d.querySelector(n):n;r=i.createApp(e),t(r,o),r.mount(f)};y?O.default({bootstrap(){console.log("\u5FAE\u5E94\u7528\uFF1Abootstrap")},mount(o){console.log("\u5FAE\u5E94\u7528\uFF1Amount",o),u(o)},unmount(o){console.log("\u5FAE\u5E94\u7528\uFF1Aunmount",o),r.unmount()},update(o){console.log("\u5FAE\u5E94\u7528\uFF1Aupdate",o)}}):u()}const K={isMicroApp:y,transformRoutes:Q,microAppPlugin:G,render:H},$={prefix:"inl",requestOmitParams:["createDt","createUser","updateDt","updateUser"]},J=()=>sessionStorage.getItem("token"),x=()=>sessionStorage.getItem("corpId"),Y=()=>{const e=sessionStorage.getItem("userinfo");if(e)return JSON.parse(e)};class X{instance;config;constructor(n){this.config=n,this.instance=q.default.create(n),this.instance.interceptors.request.use(t=>{const r=Y(),u=J(),o=x();return E.isEmpty(t.data)||(t.data=E.omit(t.data,...$.requestOmitParams)),t.headers.token=u,t.headers.userId=r?.userId,t.headers.userName=r?.userName,t.headers.corpId=o,t},t=>Promise.reject(t)),this.instance.interceptors.response.use(t=>new Promise((r,u)=>{if(t.config.responseType==="blob"&&r(t.data),t.data.code==="M0000")r(t.data);else if(t.data.code==="M4003")this.config.onTokenExpired?.(t),u(t);else{const o=t.data.message??"\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458";z.message.error(o,o.length>10?10:3),u(t.data)}}),t=>Promise.reject(t))}}const I={changeTheme:V,setRem:W,microAppUtils:K,ApiInstance:X};var k=Object.freeze({__proto__:null,focusDirective:{mounted(e,{value:n}){n!==!1&&e.focus()}},autoScroll:{mounted(e,{value:n="ant-table-body",modifiers:t}){let r,u,o=!1,d=!1;const{self:f}=t,g=window.innerWidth/window.innerHeight>2?7200:2880,_=Math.ceil(g/window.innerWidth),p=()=>o=!0,b=()=>o=!1,m=f?e:e.querySelector(`.${n}`);!m||(r=setInterval(()=>{if(!document.contains(e)){r&&clearInterval(r),e.removeEventListener("mouseenter",p),e.removeEventListener("mouseleave",b);return}if(o)return;const l=m.getBoundingClientRect().height;if(!(l>=m.scrollHeight))if(!o&&m.scrollTop+l>m.scrollHeight-_){if(u)return;u=setTimeout(()=>{o||(m.scrollTop=0),setTimeout(()=>{o||(d=!1)},1e3),u=null},1e3),d=!0}else d||m.scrollTo({top:m.scrollTop+_})},100),e.addEventListener("mouseenter",p),e.addEventListener("mouseleave",b))}}});function Z(e){const n=i.ref();return P.useIntervalFn(()=>{const t=R.default();n.value=e?t.format(e):t},1e3,{immediate:!1,immediateCallback:!0}),n}function ee(e,n,t="totalCount"){const r=i.ref([]),u=i.ref(!1),o=i.ref(0),d=async()=>{u.value=!0;try{const{data:l}=await e();n?(r.value=l[n],o.value=l[t]):r.value=l}finally{u.value=!1}},f=E.debounce(d,200),g=i.ref(1),_=l=>{g.value=l,d()};i.watch(o,()=>{const l=Math.ceil(o.value/p.value);g.value>1&&g.value>l&&(g.value=l,d())});const p=i.ref(10),b=l=>{g.value=1,p.value=l,d()},m=i.reactive({current:g,pageSize:p,total:o,showSizeChanger:!0,showQuickJumper:!0,showTotal:l=>`\u5171 ${l} \u6761`,"onUpdate:current":_,"onUpdate:pageSize":b});return{isLoading:u,tableList:r,currPage:g,handlePageChange:_,pageSize:p,hanldePageSizeChange:b,total:o,refresh:f,pagination:m}}function te(e=!1){const n=i.ref(e),t=i.ref();return[n,r=>{r&&(t.value=r),n.value=!n.value},t]}function ne(e){let n=!1;const t=i.ref({});if(U.default.isEmpty(e))return t;const{onGlobalStateChange:r,offGlobalStateChange:u,setGlobalState:o}=e,d=f=>{n=!0,t.value=f,i.nextTick(()=>n=!1)};return i.watch(t,f=>{n||o(f)},{deep:!0}),i.onMounted(()=>r(d,!0)),i.onBeforeUnmount(()=>u()),t}var N=Object.freeze({__proto__:null,useNow:Z,useTableList:ee,useModalVisible:te,useQianKunState:ne});const{prefix:oe}=$;function C(e,n,t=!0){return e.install=r=>{n=t?`${oe}-${n}`:n,r.component(n,e)},e}const ae=i.defineComponent({props:{name:{type:String,default:"\u5F20\u4E09"}},setup(e){return()=>i.createVNode("div",{class:"Demo"},["\u6211\u662Fdemo, ",e.name])}});var re=C(ae,"demo");const se=j.createFromIconfontCN();var ue=C(se,"icon-font",!1),F=Object.freeze({__proto__:null,Demo:re,IconFont:ue}),ie={install(e){for(const n of Object.values(F))e.use(n);require("./iconfont.js")},version:T,utils:I,directives:k,hooks:N,components:F};return h.components=F,h.default=ie,h.directives=k,h.hooks=N,h.utils=I,h.version=T,Object.defineProperty(h,"__esModule",{value:!0}),h}({},c,s,vue,a,antDesignVue,S,core,s$1,iconsVue);
|
|
@@ -32,6 +32,7 @@ export declare const relaTable: () => Promise<import("axios").AxiosResponse<any>
|
|
|
32
32
|
export declare const uploadCommon: (data: any, headers: any) => Promise<import("axios").AxiosResponse<any>>;
|
|
33
33
|
export declare const importExcel: (data: any) => Promise<import("axios").AxiosResponse<any>>;
|
|
34
34
|
export declare const exportExcelTemplate: () => Promise<import("axios").AxiosResponse<any>>;
|
|
35
|
+
export declare const downExcelTemplate: () => Promise<import("axios").AxiosResponse<any>>;
|
|
35
36
|
export declare const checkCode: (code: any) => Promise<import("axios").AxiosResponse<any>>;
|
|
36
37
|
declare const _default: "";
|
|
37
38
|
export default _default;
|
package/dist/src/pageComponent/views/systemManager/orgManager/depManager/batchImportModal.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 批量导入人员
|
|
3
|
+
*/
|
|
4
|
+
declare const BatchImportModal: import("vue").DefineComponent<{
|
|
5
|
+
visible: {
|
|
6
|
+
type: BooleanConstructor;
|
|
7
|
+
default: boolean;
|
|
8
|
+
};
|
|
9
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:visible" | "refresh")[], "update:visible" | "refresh", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
visible: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
}>> & {
|
|
15
|
+
"onUpdate:visible"?: ((...args: any[]) => any) | undefined;
|
|
16
|
+
onRefresh?: ((...args: any[]) => any) | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
visible: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
export default BatchImportModal;
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var qiankun = require('vite-plugin-qiankun');
|
|
6
|
+
var renderWithQiankun = require('vite-plugin-qiankun/dist/helper');
|
|
7
|
+
var vue = require('vue');
|
|
8
|
+
var axios = require('axios');
|
|
9
|
+
var antDesignVue = require('ant-design-vue');
|
|
10
|
+
var lodash = require('lodash');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
+
|
|
14
|
+
var qiankun__default = /*#__PURE__*/_interopDefaultLegacy(qiankun);
|
|
15
|
+
var renderWithQiankun__default = /*#__PURE__*/_interopDefaultLegacy(renderWithQiankun);
|
|
16
|
+
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
17
|
+
|
|
18
|
+
const setTheme = theme => {
|
|
19
|
+
if (theme === "dark") {
|
|
20
|
+
document.getElementsByTagName("html")[0].setAttribute("data-doc-theme", "dark");
|
|
21
|
+
document.getElementsByTagName("body")[0].setAttribute("data-theme", "dark");
|
|
22
|
+
document.getElementsByTagName("html")[0].style.colorScheme = "dark";
|
|
23
|
+
} else {
|
|
24
|
+
document.getElementsByTagName("html")[0].setAttribute("data-doc-theme", "light");
|
|
25
|
+
document.getElementsByTagName("body")[0].setAttribute("data-theme", "light");
|
|
26
|
+
document.getElementsByTagName("html")[0].style.colorScheme = "light";
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var changeTheme = {
|
|
30
|
+
set(theme) {
|
|
31
|
+
window.localStorage.setItem("theme", theme);
|
|
32
|
+
setTheme(theme);
|
|
33
|
+
},
|
|
34
|
+
settingTheme(theme) {
|
|
35
|
+
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
36
|
+
theme = theme || window.localStorage.getItem("theme") || systemTheme;
|
|
37
|
+
setTheme(theme);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const setRem = opt => {
|
|
42
|
+
const fontSize = opt.fontSize || 14;
|
|
43
|
+
const designSize = opt.designSize || 1920;
|
|
44
|
+
const scale = document.documentElement.clientWidth / designSize;
|
|
45
|
+
document.documentElement.style.fontSize = `${fontSize * Math.min(scale, 2)}px`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const isMicroApp = renderWithQiankun.qiankunWindow.__POWERED_BY_QIANKUN__;
|
|
49
|
+
const transformRoutes = (appName, routes) => {
|
|
50
|
+
if (isMicroApp) {
|
|
51
|
+
let addBase = function (rs) {
|
|
52
|
+
for (const r of rs) {
|
|
53
|
+
r.path = `/${appName}${r.path}`;
|
|
54
|
+
if (r.children?.length) {
|
|
55
|
+
addBase(r.children);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
const newRoutes = routes.filter(item => item.name !== "login" && item.path !== "/login");
|
|
60
|
+
addBase(routes);
|
|
61
|
+
newRoutes.push({
|
|
62
|
+
path: "/:pathMatch(.*)*",
|
|
63
|
+
component: {
|
|
64
|
+
render: () => ""
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
return newRoutes;
|
|
68
|
+
}
|
|
69
|
+
return routes;
|
|
70
|
+
};
|
|
71
|
+
function microAppPlugin(name) {
|
|
72
|
+
return qiankun__default["default"](name, {
|
|
73
|
+
useDevMode: true
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function render(AppRoot, rootEl, configApp) {
|
|
77
|
+
let app;
|
|
78
|
+
const _render = (props = {}) => {
|
|
79
|
+
const {
|
|
80
|
+
container
|
|
81
|
+
} = props;
|
|
82
|
+
const root = container ? container.querySelector(rootEl) : rootEl;
|
|
83
|
+
app = vue.createApp(AppRoot);
|
|
84
|
+
configApp(app, props);
|
|
85
|
+
app.mount(root);
|
|
86
|
+
};
|
|
87
|
+
const initQianKun = () => {
|
|
88
|
+
renderWithQiankun__default["default"]({
|
|
89
|
+
bootstrap() {
|
|
90
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Abootstrap");
|
|
91
|
+
},
|
|
92
|
+
mount(props) {
|
|
93
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Amount", props);
|
|
94
|
+
_render(props);
|
|
95
|
+
},
|
|
96
|
+
unmount(props) {
|
|
97
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Aunmount", props);
|
|
98
|
+
app.unmount();
|
|
99
|
+
},
|
|
100
|
+
update(props) {
|
|
101
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Aupdate", props);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
isMicroApp ? initQianKun() : _render();
|
|
106
|
+
}
|
|
107
|
+
const microAppUtils = {
|
|
108
|
+
isMicroApp,
|
|
109
|
+
transformRoutes,
|
|
110
|
+
microAppPlugin,
|
|
111
|
+
render
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const config = {
|
|
115
|
+
prefix: "inl",
|
|
116
|
+
requestOmitParams: ["createDt", "createUser", "updateDt", "updateUser"]
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const getToken = () => sessionStorage.getItem("token");
|
|
120
|
+
const getCorpId = () => sessionStorage.getItem("corpId");
|
|
121
|
+
const getUserinfo = () => {
|
|
122
|
+
const jsonString = sessionStorage.getItem("userinfo");
|
|
123
|
+
if (jsonString) {
|
|
124
|
+
return JSON.parse(jsonString);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
class ApiInstance {
|
|
128
|
+
instance;
|
|
129
|
+
config;
|
|
130
|
+
constructor(config$1) {
|
|
131
|
+
this.config = config$1;
|
|
132
|
+
this.instance = axios__default["default"].create(config$1);
|
|
133
|
+
this.instance.interceptors.request.use(config2 => {
|
|
134
|
+
const userinfo = getUserinfo();
|
|
135
|
+
const token = getToken();
|
|
136
|
+
const corpId = getCorpId();
|
|
137
|
+
if (!lodash.isEmpty(config2.data)) {
|
|
138
|
+
config2.data = lodash.omit(config2.data, ...config.requestOmitParams);
|
|
139
|
+
}
|
|
140
|
+
config2.headers.token = token;
|
|
141
|
+
config2.headers.userId = userinfo?.userId;
|
|
142
|
+
config2.headers.userName = userinfo?.userName;
|
|
143
|
+
config2.headers.corpId = corpId;
|
|
144
|
+
return config2;
|
|
145
|
+
}, err => {
|
|
146
|
+
return Promise.reject(err);
|
|
147
|
+
});
|
|
148
|
+
this.instance.interceptors.response.use(res => {
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
if (res.config.responseType === "blob") {
|
|
151
|
+
resolve(res.data);
|
|
152
|
+
}
|
|
153
|
+
if (res.data.code === "M0000") {
|
|
154
|
+
resolve(res.data);
|
|
155
|
+
} else if (res.data.code === "M4003") {
|
|
156
|
+
this.config.onTokenExpired?.(res);
|
|
157
|
+
reject(res);
|
|
158
|
+
} else {
|
|
159
|
+
const alertMessage = res.data.message ?? "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458";
|
|
160
|
+
antDesignVue.message.error(alertMessage, alertMessage.length > 10 ? 10 : 3);
|
|
161
|
+
reject(res.data);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}, err => {
|
|
165
|
+
return Promise.reject(err);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const utils = {
|
|
171
|
+
changeTheme,
|
|
172
|
+
setRem,
|
|
173
|
+
microAppUtils,
|
|
174
|
+
ApiInstance
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
exports.ApiInstance = ApiInstance;
|
|
178
|
+
exports.changeTheme = changeTheme;
|
|
179
|
+
exports["default"] = utils;
|
|
180
|
+
exports.microAppUtils = microAppUtils;
|
|
181
|
+
exports.setRem = setRem;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as vite_plugin_qiankun_dist_helper from 'vite-plugin-qiankun/dist/helper';
|
|
2
|
+
import { QiankunProps } from 'vite-plugin-qiankun/dist/helper';
|
|
3
|
+
import * as vue from 'vue';
|
|
4
|
+
import { Component, App } from 'vue';
|
|
5
|
+
import * as vite from 'vite';
|
|
6
|
+
import * as vue_router from 'vue-router';
|
|
7
|
+
import { RouteRecordRaw } from 'vue-router';
|
|
8
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
9
|
+
|
|
10
|
+
declare const _default: {
|
|
11
|
+
set(theme: string): void;
|
|
12
|
+
settingTheme(theme?: string): void;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param opt
|
|
18
|
+
* @param opt.fontSize 基础字体大小
|
|
19
|
+
* @param opt.designSize 设计稿基数
|
|
20
|
+
*/
|
|
21
|
+
declare const setRem: (opt: {
|
|
22
|
+
fontSize?: number;
|
|
23
|
+
designSize?: number;
|
|
24
|
+
}) => void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 微应用 vite 插件
|
|
28
|
+
* @param name 微应用name
|
|
29
|
+
*/
|
|
30
|
+
declare function microAppPlugin(name: string): vite.PluginOption;
|
|
31
|
+
/**
|
|
32
|
+
* render函数
|
|
33
|
+
* @param AppRoot 根组件
|
|
34
|
+
* @param rootEl 根dom
|
|
35
|
+
* @param configApp 用于配置app
|
|
36
|
+
*/
|
|
37
|
+
declare function render(AppRoot: Component, rootEl: string, configApp: (app: App, props?: QiankunProps) => any): void;
|
|
38
|
+
declare const microAppUtils: {
|
|
39
|
+
isMicroApp: boolean | undefined;
|
|
40
|
+
transformRoutes: (appName: string, routes: RouteRecordRaw[]) => RouteRecordRaw[];
|
|
41
|
+
microAppPlugin: typeof microAppPlugin;
|
|
42
|
+
render: typeof render;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
interface IApiInstanceConfig extends AxiosRequestConfig {
|
|
46
|
+
onTokenExpired?: (res: AxiosResponse) => void;
|
|
47
|
+
}
|
|
48
|
+
declare class ApiInstance {
|
|
49
|
+
instance: AxiosInstance;
|
|
50
|
+
config: IApiInstanceConfig;
|
|
51
|
+
constructor(config: IApiInstanceConfig);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare const utils: {
|
|
55
|
+
changeTheme: {
|
|
56
|
+
set(theme: string): void;
|
|
57
|
+
settingTheme(theme?: string | undefined): void;
|
|
58
|
+
};
|
|
59
|
+
setRem: (opt: {
|
|
60
|
+
fontSize?: number | undefined;
|
|
61
|
+
designSize?: number | undefined;
|
|
62
|
+
}) => void;
|
|
63
|
+
microAppUtils: {
|
|
64
|
+
isMicroApp: boolean | undefined;
|
|
65
|
+
transformRoutes: (appName: string, routes: vue_router.RouteRecordRaw[]) => vue_router.RouteRecordRaw[];
|
|
66
|
+
microAppPlugin: (name: string) => vite.PluginOption;
|
|
67
|
+
render: (AppRoot: vue.Component<any, any, any, vue.ComputedOptions, vue.MethodOptions>, rootEl: string, configApp: (app: vue.App<any>, props?: vite_plugin_qiankun_dist_helper.QiankunProps | undefined) => any) => void;
|
|
68
|
+
};
|
|
69
|
+
ApiInstance: typeof ApiInstance;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export { ApiInstance, _default as changeTheme, utils as default, microAppUtils, setRem };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import qiankun from 'vite-plugin-qiankun';
|
|
2
|
+
import renderWithQiankun, { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
|
3
|
+
import { createApp } from 'vue';
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { message } from 'ant-design-vue';
|
|
6
|
+
import { isEmpty, omit } from 'lodash';
|
|
7
|
+
|
|
8
|
+
const setTheme = theme => {
|
|
9
|
+
if (theme === "dark") {
|
|
10
|
+
document.getElementsByTagName("html")[0].setAttribute("data-doc-theme", "dark");
|
|
11
|
+
document.getElementsByTagName("body")[0].setAttribute("data-theme", "dark");
|
|
12
|
+
document.getElementsByTagName("html")[0].style.colorScheme = "dark";
|
|
13
|
+
} else {
|
|
14
|
+
document.getElementsByTagName("html")[0].setAttribute("data-doc-theme", "light");
|
|
15
|
+
document.getElementsByTagName("body")[0].setAttribute("data-theme", "light");
|
|
16
|
+
document.getElementsByTagName("html")[0].style.colorScheme = "light";
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var changeTheme = {
|
|
20
|
+
set(theme) {
|
|
21
|
+
window.localStorage.setItem("theme", theme);
|
|
22
|
+
setTheme(theme);
|
|
23
|
+
},
|
|
24
|
+
settingTheme(theme) {
|
|
25
|
+
const systemTheme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
26
|
+
theme = theme || window.localStorage.getItem("theme") || systemTheme;
|
|
27
|
+
setTheme(theme);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const setRem = opt => {
|
|
32
|
+
const fontSize = opt.fontSize || 14;
|
|
33
|
+
const designSize = opt.designSize || 1920;
|
|
34
|
+
const scale = document.documentElement.clientWidth / designSize;
|
|
35
|
+
document.documentElement.style.fontSize = `${fontSize * Math.min(scale, 2)}px`;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const isMicroApp = qiankunWindow.__POWERED_BY_QIANKUN__;
|
|
39
|
+
const transformRoutes = (appName, routes) => {
|
|
40
|
+
if (isMicroApp) {
|
|
41
|
+
let addBase = function (rs) {
|
|
42
|
+
for (const r of rs) {
|
|
43
|
+
r.path = `/${appName}${r.path}`;
|
|
44
|
+
if (r.children?.length) {
|
|
45
|
+
addBase(r.children);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const newRoutes = routes.filter(item => item.name !== "login" && item.path !== "/login");
|
|
50
|
+
addBase(routes);
|
|
51
|
+
newRoutes.push({
|
|
52
|
+
path: "/:pathMatch(.*)*",
|
|
53
|
+
component: {
|
|
54
|
+
render: () => ""
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return newRoutes;
|
|
58
|
+
}
|
|
59
|
+
return routes;
|
|
60
|
+
};
|
|
61
|
+
function microAppPlugin(name) {
|
|
62
|
+
return qiankun(name, {
|
|
63
|
+
useDevMode: true
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function render(AppRoot, rootEl, configApp) {
|
|
67
|
+
let app;
|
|
68
|
+
const _render = (props = {}) => {
|
|
69
|
+
const {
|
|
70
|
+
container
|
|
71
|
+
} = props;
|
|
72
|
+
const root = container ? container.querySelector(rootEl) : rootEl;
|
|
73
|
+
app = createApp(AppRoot);
|
|
74
|
+
configApp(app, props);
|
|
75
|
+
app.mount(root);
|
|
76
|
+
};
|
|
77
|
+
const initQianKun = () => {
|
|
78
|
+
renderWithQiankun({
|
|
79
|
+
bootstrap() {
|
|
80
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Abootstrap");
|
|
81
|
+
},
|
|
82
|
+
mount(props) {
|
|
83
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Amount", props);
|
|
84
|
+
_render(props);
|
|
85
|
+
},
|
|
86
|
+
unmount(props) {
|
|
87
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Aunmount", props);
|
|
88
|
+
app.unmount();
|
|
89
|
+
},
|
|
90
|
+
update(props) {
|
|
91
|
+
console.log("\u5FAE\u5E94\u7528\uFF1Aupdate", props);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
isMicroApp ? initQianKun() : _render();
|
|
96
|
+
}
|
|
97
|
+
const microAppUtils = {
|
|
98
|
+
isMicroApp,
|
|
99
|
+
transformRoutes,
|
|
100
|
+
microAppPlugin,
|
|
101
|
+
render
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const config = {
|
|
105
|
+
prefix: "inl",
|
|
106
|
+
requestOmitParams: ["createDt", "createUser", "updateDt", "updateUser"]
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const getToken = () => sessionStorage.getItem("token");
|
|
110
|
+
const getCorpId = () => sessionStorage.getItem("corpId");
|
|
111
|
+
const getUserinfo = () => {
|
|
112
|
+
const jsonString = sessionStorage.getItem("userinfo");
|
|
113
|
+
if (jsonString) {
|
|
114
|
+
return JSON.parse(jsonString);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
class ApiInstance {
|
|
118
|
+
instance;
|
|
119
|
+
config;
|
|
120
|
+
constructor(config$1) {
|
|
121
|
+
this.config = config$1;
|
|
122
|
+
this.instance = axios.create(config$1);
|
|
123
|
+
this.instance.interceptors.request.use(config2 => {
|
|
124
|
+
const userinfo = getUserinfo();
|
|
125
|
+
const token = getToken();
|
|
126
|
+
const corpId = getCorpId();
|
|
127
|
+
if (!isEmpty(config2.data)) {
|
|
128
|
+
config2.data = omit(config2.data, ...config.requestOmitParams);
|
|
129
|
+
}
|
|
130
|
+
config2.headers.token = token;
|
|
131
|
+
config2.headers.userId = userinfo?.userId;
|
|
132
|
+
config2.headers.userName = userinfo?.userName;
|
|
133
|
+
config2.headers.corpId = corpId;
|
|
134
|
+
return config2;
|
|
135
|
+
}, err => {
|
|
136
|
+
return Promise.reject(err);
|
|
137
|
+
});
|
|
138
|
+
this.instance.interceptors.response.use(res => {
|
|
139
|
+
return new Promise((resolve, reject) => {
|
|
140
|
+
if (res.config.responseType === "blob") {
|
|
141
|
+
resolve(res.data);
|
|
142
|
+
}
|
|
143
|
+
if (res.data.code === "M0000") {
|
|
144
|
+
resolve(res.data);
|
|
145
|
+
} else if (res.data.code === "M4003") {
|
|
146
|
+
this.config.onTokenExpired?.(res);
|
|
147
|
+
reject(res);
|
|
148
|
+
} else {
|
|
149
|
+
const alertMessage = res.data.message ?? "\u7F51\u7EDC\u5F02\u5E38\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458";
|
|
150
|
+
message.error(alertMessage, alertMessage.length > 10 ? 10 : 3);
|
|
151
|
+
reject(res.data);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}, err => {
|
|
155
|
+
return Promise.reject(err);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const utils = {
|
|
161
|
+
changeTheme,
|
|
162
|
+
setRem,
|
|
163
|
+
microAppUtils,
|
|
164
|
+
ApiInstance
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export { ApiInstance, changeTheme, utils as default, microAppUtils, setRem };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inl-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "工业 pc ui库",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./dist/types/src/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"axios": "^0.21.1",
|
|
21
21
|
"fabric": "^5.2.4",
|
|
22
22
|
"fabric-guideline-plugin": "^0.0.11",
|
|
23
|
-
"inl-card": "^0.0.
|
|
23
|
+
"inl-card": "^0.0.66",
|
|
24
24
|
"mitt": "^3.0.0",
|
|
25
25
|
"moment": "^2.29.1",
|
|
26
26
|
"vitevuu": "^1.0.9",
|
|
@@ -51,4 +51,4 @@
|
|
|
51
51
|
"vue-router": "4",
|
|
52
52
|
"vuex": "^4.0.2"
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
package/src/api/thingModel.ts
CHANGED
|
@@ -100,6 +100,7 @@ export const importExcel = (data) =>
|
|
|
100
100
|
headers: {
|
|
101
101
|
"Content-Type": "multipart/form-data",
|
|
102
102
|
},
|
|
103
|
+
timeout: 1000 * 180,
|
|
103
104
|
});
|
|
104
105
|
// 导出全部
|
|
105
106
|
export const exportExcelTemplate = () =>
|
|
@@ -115,7 +116,19 @@ export const exportExcelTemplate = () =>
|
|
|
115
116
|
timeout: 1000 * 30,
|
|
116
117
|
}
|
|
117
118
|
);
|
|
118
|
-
|
|
119
|
+
// 下载模板
|
|
120
|
+
export const downExcelTemplate = () =>
|
|
121
|
+
instance.post(
|
|
122
|
+
`/thing/v1/core/excelOpt/thing/exportNullExcelTemplate`,
|
|
123
|
+
{},
|
|
124
|
+
{
|
|
125
|
+
responseType: "blob",
|
|
126
|
+
headers: {
|
|
127
|
+
"Content-Disposition": "attachment",
|
|
128
|
+
"Content-Type": "text/html;charset=UTF-8",
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
);
|
|
119
132
|
// 校验实例code是否重复
|
|
120
133
|
export const checkCode = (code) =>
|
|
121
134
|
instance.get(`/thing/v1/core/thing/hasThingcode/${code}`);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { defineComponent, ref, watch } from "vue";
|
|
2
|
+
import useVModel from "@/pageComponent/hooks/useVModel";
|
|
3
|
+
import { message } from "ant-design-vue";
|
|
4
|
+
import { FileExcelTwoTone, InboxOutlined } from "@ant-design/icons-vue";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 批量导入人员
|
|
8
|
+
*/
|
|
9
|
+
const BatchImportModal = defineComponent({
|
|
10
|
+
emits: ["update:visible", "refresh"],
|
|
11
|
+
props: {
|
|
12
|
+
visible: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
setup(props, { emit }) {
|
|
18
|
+
const isVisible = useVModel(props, "visible", emit);
|
|
19
|
+
|
|
20
|
+
const isLoading = ref(false);
|
|
21
|
+
const fileList = ref<any[]>([]);
|
|
22
|
+
|
|
23
|
+
const handleUpload = async () => {
|
|
24
|
+
isLoading.value = true;
|
|
25
|
+
setTimeout(() => {
|
|
26
|
+
message.success("导入成功");
|
|
27
|
+
isVisible.value = false;
|
|
28
|
+
emit("refresh");
|
|
29
|
+
}, 1000);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// 关闭后清空上传列表
|
|
33
|
+
watch(isVisible, (val) => {
|
|
34
|
+
if (!val) {
|
|
35
|
+
fileList.value = [];
|
|
36
|
+
isLoading.value = false;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return () => (
|
|
41
|
+
<div class="batchImportModal">
|
|
42
|
+
<a-modal
|
|
43
|
+
title="批量导入"
|
|
44
|
+
v-model={[isVisible.value, "visible"]}
|
|
45
|
+
v-slots={{
|
|
46
|
+
footer: () => (
|
|
47
|
+
<a-space>
|
|
48
|
+
<a-button
|
|
49
|
+
type="primary"
|
|
50
|
+
disabled={!fileList.value.length}
|
|
51
|
+
loading={isLoading.value}
|
|
52
|
+
onClick={handleUpload}
|
|
53
|
+
>
|
|
54
|
+
上传文件
|
|
55
|
+
</a-button>
|
|
56
|
+
<a-button onClick={() => (isVisible.value = false)}>
|
|
57
|
+
取消
|
|
58
|
+
</a-button>
|
|
59
|
+
</a-space>
|
|
60
|
+
),
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<a-alert showIcon type="warning">
|
|
64
|
+
{{
|
|
65
|
+
message: () => (
|
|
66
|
+
<span
|
|
67
|
+
style={{
|
|
68
|
+
display: "flex",
|
|
69
|
+
justifyContent: "space-between",
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
<span style={{ color: "#915B28" }}>
|
|
73
|
+
请先下载模版并按要求填写信息,否则可能导入失败
|
|
74
|
+
</span>
|
|
75
|
+
<a
|
|
76
|
+
target="_BLANK"
|
|
77
|
+
href="/api/common/v1/employee/export/template"
|
|
78
|
+
>
|
|
79
|
+
人员模版
|
|
80
|
+
</a>
|
|
81
|
+
</span>
|
|
82
|
+
),
|
|
83
|
+
}}
|
|
84
|
+
</a-alert>
|
|
85
|
+
<a-upload-dragger
|
|
86
|
+
style={{ margin: "16px 0" }}
|
|
87
|
+
showUploadList={false}
|
|
88
|
+
beforeUpload={() => false}
|
|
89
|
+
multiple={false}
|
|
90
|
+
onChange={({ file }) => (fileList.value = [file])}
|
|
91
|
+
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
92
|
+
v-model={[fileList.value, "fileList"]}
|
|
93
|
+
>
|
|
94
|
+
{fileList.value.length ? (
|
|
95
|
+
<>
|
|
96
|
+
<p class="ant-upload-drag-icon">
|
|
97
|
+
<FileExcelTwoTone twoToneColor="#00C090" />
|
|
98
|
+
</p>
|
|
99
|
+
<p class="ant-upload-text">{fileList.value[0].name}</p>
|
|
100
|
+
<p class="ant-upload-hint">
|
|
101
|
+
<a-button>重新上传</a-button>
|
|
102
|
+
</p>
|
|
103
|
+
</>
|
|
104
|
+
) : (
|
|
105
|
+
<>
|
|
106
|
+
<p class="ant-upload-drag-icon">
|
|
107
|
+
<InboxOutlined />
|
|
108
|
+
</p>
|
|
109
|
+
<p class="ant-upload-text">点击或将文件拖拽到这里上传</p>
|
|
110
|
+
<p class="ant-upload-hint">支持格式: xls/xlsx</p>
|
|
111
|
+
</>
|
|
112
|
+
)}
|
|
113
|
+
</a-upload-dragger>
|
|
114
|
+
</a-modal>
|
|
115
|
+
</div>
|
|
116
|
+
);
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export default BatchImportModal;
|