widget.qw 0.0.1
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/README.md +73 -0
- package/build/favicon.ico +0 -0
- package/build/style.css +763 -0
- package/build/widget.qw.es.js +20653 -0
- package/build/widget.qw.umd.js +20660 -0
- package/index.html +17 -0
- package/package.json +47 -0
- package/public/favicon.ico +0 -0
- package/src/App.vue +26 -0
- package/src/api/index.js +126 -0
- package/src/assets/avatar.png +0 -0
- package/src/assets/banner_handle.png +0 -0
- package/src/assets/bg_blue.png +0 -0
- package/src/assets/bg_white.png +0 -0
- package/src/assets/down.png +0 -0
- package/src/assets/home.jpg +0 -0
- package/src/assets/icon_box.png +0 -0
- package/src/assets/icon_dot.png +0 -0
- package/src/assets/icon_draw.png +0 -0
- package/src/assets/icon_file.png +0 -0
- package/src/assets/icon_fold.png +0 -0
- package/src/assets/icon_shield.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/AuditBar.vue +341 -0
- package/src/components/BillCard.vue +156 -0
- package/src/components/CheckGroup.vue +114 -0
- package/src/components/DatetimePicker/DatetimePop.vue +343 -0
- package/src/components/DatetimePicker/index.vue +113 -0
- package/src/components/DayDropdown.vue +57 -0
- package/src/components/FilePicker.vue +114 -0
- package/src/components/Input.vue +72 -0
- package/src/components/MonthDropdown.vue +52 -0
- package/src/components/MultiPicker.vue +124 -0
- package/src/components/ProjectDropdown.vue +62 -0
- package/src/components/ProjectPicker.vue +111 -0
- package/src/components/SecretNotify.js +6 -0
- package/src/components/Sheet.vue +93 -0
- package/src/components/SinglePicker.vue +103 -0
- package/src/components/SingleUserSelector.vue +425 -0
- package/src/components/Switch.vue +65 -0
- package/src/components/TreePicker.vue +113 -0
- package/src/components/UserPicker.vue +107 -0
- package/src/components/UserProfile.vue +128 -0
- package/src/components/UsersPicker.vue +118 -0
- package/src/components/YearDropdown.vue +60 -0
- package/src/components/data_selector.vue +281 -0
- package/src/components/image_picker.vue +115 -0
- package/src/components/images_picker.vue +140 -0
- package/src/components/index.js +157 -0
- package/src/components/mult_list_selector.vue +156 -0
- package/src/components/product_selector.vue +186 -0
- package/src/components/subdepartment_selector.vue +481 -0
- package/src/components/user_selector.vue +639 -0
- package/src/components/widget/DataPop.vue +96 -0
- package/src/components/widget/TreePop.vue +89 -0
- package/src/components/widget/UserPop.vue +347 -0
- package/src/env.d.ts +8 -0
- package/src/main.js +111 -0
- package/src/router/index.ts +165 -0
- package/src/util/array_util.js +32 -0
- package/src/util/auth_util.js +73 -0
- package/src/util/bool_util.js +6 -0
- package/src/util/bus.js +2 -0
- package/src/util/cache_util.js +19 -0
- package/src/util/errer_code.js +7 -0
- package/src/util/eval_util.js +20 -0
- package/src/util/icon_util.js +37 -0
- package/src/util/image_util.js +28 -0
- package/src/util/index.js +56 -0
- package/src/util/num_util.js +71 -0
- package/src/util/obj_util.js +29 -0
- package/src/util/request.js +74 -0
- package/src/util/request_json.js +72 -0
- package/src/util/request_json_mute.js +66 -0
- package/src/util/request_upload.js +79 -0
- package/src/util/route_util.js +32 -0
- package/src/util/str_util.js +144 -0
- package/src/util/time_util.js +407 -0
- package/src/util/toast_util.js +25 -0
- package/src/util/tree_util.js +120 -0
- package/src/util/validate.js +183 -0
- package/src/util/vue_filter.js +223 -0
- package/src/views/auditbar/index.vue +66 -0
- package/src/views/billcard/index.vue +46 -0
- package/src/views/checkgroup/index.vue +36 -0
- package/src/views/dataSelector/index.vue +49 -0
- package/src/views/datetimepicker/index.vue +35 -0
- package/src/views/daydropdown/index.vue +31 -0
- package/src/views/filepicker/index.vue +32 -0
- package/src/views/home/index.vue +64 -0
- package/src/views/imagepicker/index.vue +32 -0
- package/src/views/imagespicker/index.vue +32 -0
- package/src/views/input/index.vue +35 -0
- package/src/views/monthdropdown/index.vue +31 -0
- package/src/views/multListSelector/index.vue +61 -0
- package/src/views/multipicker/index.vue +37 -0
- package/src/views/productSelector/index.vue +35 -0
- package/src/views/projectdropdown/index.vue +31 -0
- package/src/views/projectpicker/index.vue +42 -0
- package/src/views/secretnotify/index.vue +28 -0
- package/src/views/sheet/index.vue +46 -0
- package/src/views/singlepicker/index.vue +36 -0
- package/src/views/subdepartmentSelector/index.vue +41 -0
- package/src/views/switch/index.vue +35 -0
- package/src/views/treepicker/index.vue +42 -0
- package/src/views/userSelector/index.vue +54 -0
- package/src/views/userSelectorNew/index.vue +45 -0
- package/src/views/userpicker/index.vue +43 -0
- package/src/views/userprofile/index.vue +30 -0
- package/src/views/userspicker/index.vue +43 -0
- package/src/views/yeardropdown/index.vue +32 -0
- package/src/vm/index.js +6 -0
- package/tsconfig.json +19 -0
- package/tsconfig.node.json +8 -0
- package/vite.config.ts +73 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import vm from '../vm'
|
|
2
|
+
import axios from "axios"
|
|
3
|
+
import qs from "qs"
|
|
4
|
+
import { NEED_LOGIN_CODES } from './errer_code.js'
|
|
5
|
+
import { getToken,TOKEN_KEY } from './auth_util.js'
|
|
6
|
+
import util from './index.js'
|
|
7
|
+
|
|
8
|
+
// create an axios instance
|
|
9
|
+
const service = axios.create({
|
|
10
|
+
baseURL: '', // url = domain + request url
|
|
11
|
+
withCredentials: true, // send cookies when cross-domain requests
|
|
12
|
+
timeout: 1000 * 60 * 10, // request timeout
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
//请求拦截器
|
|
16
|
+
service.interceptors.request.use(
|
|
17
|
+
config => {
|
|
18
|
+
util.showLoading()
|
|
19
|
+
|
|
20
|
+
//请求头加token
|
|
21
|
+
config.headers[TOKEN_KEY] = getToken()
|
|
22
|
+
|
|
23
|
+
config.headers['Content-Type'] = 'application/json'
|
|
24
|
+
config.data = JSON.stringify(config.data)
|
|
25
|
+
return config
|
|
26
|
+
},
|
|
27
|
+
error => {
|
|
28
|
+
// do something with request error
|
|
29
|
+
console.log(error) // for debug
|
|
30
|
+
util.hideLoading()
|
|
31
|
+
util.warnToast(error)
|
|
32
|
+
return Promise.reject(error)
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
//响应拦截器
|
|
37
|
+
service.interceptors.response.use(
|
|
38
|
+
response => {
|
|
39
|
+
util.hideLoading()
|
|
40
|
+
|
|
41
|
+
const res = response.data
|
|
42
|
+
console.log(res)
|
|
43
|
+
|
|
44
|
+
if (res.code !== 200) {
|
|
45
|
+
util.warnToast(res.msg || "Error")
|
|
46
|
+
|
|
47
|
+
console.log(NEED_LOGIN_CODES)
|
|
48
|
+
|
|
49
|
+
if (NEED_LOGIN_CODES.indexOf(res.code) >= 0) {
|
|
50
|
+
util.warnToast('请登录')
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
if (vm.needLoginCallback) {
|
|
53
|
+
vm.needLoginCallback()
|
|
54
|
+
}
|
|
55
|
+
return
|
|
56
|
+
}, 1500)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return res
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return res
|
|
63
|
+
},
|
|
64
|
+
error => {
|
|
65
|
+
util.hideLoading()
|
|
66
|
+
console.log("err" + error) // for debug
|
|
67
|
+
util.warnToast(error.message)
|
|
68
|
+
return Promise.reject(error)
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
export default service
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import vm from '../vm'
|
|
2
|
+
import axios from "axios"
|
|
3
|
+
import qs from "qs"
|
|
4
|
+
import { NEED_LOGIN_CODES } from './errer_code.js'
|
|
5
|
+
import { getToken,TOKEN_KEY } from './auth_util.js'
|
|
6
|
+
import util from './index.js'
|
|
7
|
+
|
|
8
|
+
// create an axios instance
|
|
9
|
+
const service = axios.create({
|
|
10
|
+
baseURL: '', // url = domain + request url
|
|
11
|
+
withCredentials: true, // send cookies when cross-domain requests
|
|
12
|
+
timeout: 1000 * 60 * 10, // request timeout
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
//请求拦截器
|
|
16
|
+
service.interceptors.request.use(
|
|
17
|
+
config => {
|
|
18
|
+
//请求头加token
|
|
19
|
+
config.headers[TOKEN_KEY] = getToken()
|
|
20
|
+
|
|
21
|
+
config.headers['Content-Type'] = 'application/json'
|
|
22
|
+
config.data = JSON.stringify(config.data)
|
|
23
|
+
return config
|
|
24
|
+
},
|
|
25
|
+
error => {
|
|
26
|
+
// do something with request error
|
|
27
|
+
console.log(error) // for debug
|
|
28
|
+
util.warnToast(error)
|
|
29
|
+
return Promise.reject(error)
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
//响应拦截器
|
|
34
|
+
service.interceptors.response.use(
|
|
35
|
+
response => {
|
|
36
|
+
const res = response.data
|
|
37
|
+
console.log(res)
|
|
38
|
+
|
|
39
|
+
if (res.code !== 200) {
|
|
40
|
+
util.warnToast(res.msg || "Error")
|
|
41
|
+
|
|
42
|
+
console.log(NEED_LOGIN_CODES)
|
|
43
|
+
|
|
44
|
+
if (NEED_LOGIN_CODES.indexOf(res.code) >= 0) {
|
|
45
|
+
util.warnToast('请登录')
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
if (vm.needLoginCallback) {
|
|
48
|
+
vm.needLoginCallback()
|
|
49
|
+
}
|
|
50
|
+
return
|
|
51
|
+
}, 1500)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return res
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return res
|
|
58
|
+
},
|
|
59
|
+
error => {
|
|
60
|
+
console.log("err" + error) // for debug
|
|
61
|
+
util.warnToast(error.message)
|
|
62
|
+
return Promise.reject(error)
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
export default service
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import vm from '../vm'
|
|
2
|
+
import axios from 'axios'
|
|
3
|
+
import { getToken, TOKEN_KEY } from './auth_util'
|
|
4
|
+
import { NEED_LOGIN_CODES } from './errer_code'
|
|
5
|
+
import util from './index.js'
|
|
6
|
+
|
|
7
|
+
// create an axios instance
|
|
8
|
+
const service = axios.create({
|
|
9
|
+
baseURL: '', // url = domain + base path + request url
|
|
10
|
+
withCredentials: true, // send cookies when cross-domain requests
|
|
11
|
+
timeout: 1000 * 60 * 10, // request timeout
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
//请求拦截器
|
|
15
|
+
service.interceptors.request.use(
|
|
16
|
+
(config) => {
|
|
17
|
+
util.showLoading()
|
|
18
|
+
|
|
19
|
+
//设置文件上传请求头
|
|
20
|
+
config.headers['Content-Type'] = 'multipart/form-data'
|
|
21
|
+
|
|
22
|
+
//请求头加token
|
|
23
|
+
config.headers[TOKEN_KEY] = getToken()
|
|
24
|
+
|
|
25
|
+
//解析并传入post参数
|
|
26
|
+
if (config.method.toLowerCase() == 'post') {
|
|
27
|
+
const form = new FormData()
|
|
28
|
+
// 文件对象
|
|
29
|
+
for (const key in config.data) {
|
|
30
|
+
form.append(key, config.data[key])
|
|
31
|
+
}
|
|
32
|
+
config.data = form
|
|
33
|
+
}
|
|
34
|
+
return config
|
|
35
|
+
},
|
|
36
|
+
(error) => {
|
|
37
|
+
util.hideLoading()
|
|
38
|
+
// do something with request error
|
|
39
|
+
console.log(error) // for debug
|
|
40
|
+
if (error.message && error.message.toUpperCase().indexOf('NETWORK') >= 0) {
|
|
41
|
+
util.warnToast('网络连接失败')
|
|
42
|
+
} else {
|
|
43
|
+
util.warnToast(error.msg || error.message || error)
|
|
44
|
+
}
|
|
45
|
+
return Promise.reject(error)
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
//响应拦截器
|
|
50
|
+
service.interceptors.response.use(
|
|
51
|
+
(response) => {
|
|
52
|
+
util.hideLoading()
|
|
53
|
+
|
|
54
|
+
const res = response.data
|
|
55
|
+
console.log(res)
|
|
56
|
+
|
|
57
|
+
if (res.code !== 200) {
|
|
58
|
+
if (NEED_LOGIN_CODES.indexOf(res.code) >= 0) {
|
|
59
|
+
if (vm.needLoginCallback) {
|
|
60
|
+
vm.needLoginCallback()
|
|
61
|
+
}
|
|
62
|
+
} else {
|
|
63
|
+
util.warnToast(res.msg || 'Error')
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return Promise.reject(new Error(res.msg || 'Error'))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return Promise.resolve(res)
|
|
70
|
+
},
|
|
71
|
+
(error) => {
|
|
72
|
+
util.hideLoading()
|
|
73
|
+
console.log('err' + error) // for debug
|
|
74
|
+
util.warnToast(error)
|
|
75
|
+
return Promise.reject(error)
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
export default service
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import qs from 'qs'
|
|
2
|
+
import * as StrUtil from './str_util'
|
|
3
|
+
|
|
4
|
+
export const getQueryParams = ()=>{
|
|
5
|
+
let href = window.location.href
|
|
6
|
+
href = StrUtil.trimSuffixHashPath(href)
|
|
7
|
+
let paramsStr = href.split('?')[1]
|
|
8
|
+
|
|
9
|
+
paramsStr = decodeURIComponent(paramsStr)
|
|
10
|
+
if(!paramsStr)
|
|
11
|
+
return {}
|
|
12
|
+
|
|
13
|
+
const params = qs.parse(paramsStr)
|
|
14
|
+
if(!params)
|
|
15
|
+
return {}
|
|
16
|
+
for(const key in params){
|
|
17
|
+
try{
|
|
18
|
+
let jsonParam = params[key].replace(/'/g, '"')
|
|
19
|
+
params[key] = JSON.parse(jsonParam)
|
|
20
|
+
}catch(e){
|
|
21
|
+
console.log(e)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return params
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 截取hash路由#之前的部分
|
|
29
|
+
export const getBaseUrl = ()=>{
|
|
30
|
+
let res = href.split('#')[0]
|
|
31
|
+
return res
|
|
32
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 计算显示的字符串
|
|
3
|
+
* @param {string} str 要裁剪的字符串
|
|
4
|
+
* @param {number} maxWidth 最大宽度
|
|
5
|
+
* @param {number} fontSize 字体大小
|
|
6
|
+
*/
|
|
7
|
+
export function fittingString(str, maxWidth, fontSize) {
|
|
8
|
+
var fontWidth = fontSize * 1.3; //字号+边距
|
|
9
|
+
maxWidth = maxWidth * 2; // 需要根据自己项目调整
|
|
10
|
+
var width = calcStrLen(str) * fontWidth;
|
|
11
|
+
var ellipsis = '…';
|
|
12
|
+
if (width > maxWidth) {
|
|
13
|
+
var actualLen = Math.floor((maxWidth - 10) / fontWidth);
|
|
14
|
+
var result = str.substring(0, actualLen) + ellipsis;
|
|
15
|
+
return result
|
|
16
|
+
}
|
|
17
|
+
return str
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 计算字符串的长度
|
|
22
|
+
* @param {string} str 指定的字符串
|
|
23
|
+
*/
|
|
24
|
+
export function calcStrLen(str) {
|
|
25
|
+
var len = 0;
|
|
26
|
+
for (var i = 0; i < str.length; i++) {
|
|
27
|
+
if (str.charCodeAt(i) > 0 && str.charCodeAt(i) < 128) {
|
|
28
|
+
len++;
|
|
29
|
+
} else {
|
|
30
|
+
len += 2;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return len;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function uppercaseFirst(str){
|
|
37
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function date2Str(datetime){
|
|
41
|
+
let Y = datetime.getFullYear()
|
|
42
|
+
let M = (datetime.getMonth()+1 < 10 ? '0'+(datetime.getMonth()+1) : datetime.getMonth()+1)
|
|
43
|
+
let D = (datetime.getDate() < 10 ? '0'+(datetime.getDate()) : datetime.getDate())
|
|
44
|
+
let h = (datetime.getHours() < 10 ? '0'+(datetime.getHours()) : datetime.getHours())
|
|
45
|
+
let m = (datetime.getMinutes() < 10 ? '0'+(datetime.getMinutes()) : datetime.getMinutes())
|
|
46
|
+
let s = (datetime.getSeconds() < 10 ? '0'+(datetime.getSeconds()) : datetime.getSeconds())
|
|
47
|
+
return `${Y}-${M}-${D} ${h}:${m}:${s}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function Number2Line(num){
|
|
51
|
+
let str = '';
|
|
52
|
+
for(var i=0; i<num; i++){
|
|
53
|
+
str += '|';
|
|
54
|
+
}
|
|
55
|
+
return str;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//阿拉伯数字转汉字
|
|
59
|
+
var chnNumChar = ["零","一","二","三","四","五","六","七","八","九"];
|
|
60
|
+
var chnUnitSection = ["","万","亿","万亿","亿亿"];
|
|
61
|
+
var chnUnitChar = ["","十","百","千"];
|
|
62
|
+
|
|
63
|
+
export function Number2Chinese(num){
|
|
64
|
+
|
|
65
|
+
var unitPos = 0;
|
|
66
|
+
var strIns = '', chnStr = '';
|
|
67
|
+
var needZero = false;
|
|
68
|
+
|
|
69
|
+
if(num === 0){
|
|
70
|
+
return chnNumChar[0];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
while(num > 0){
|
|
74
|
+
var section = num % 10000;
|
|
75
|
+
if(needZero){
|
|
76
|
+
chnStr = chnNumChar[0] + chnStr;
|
|
77
|
+
}
|
|
78
|
+
strIns = SectionToChinese(section);
|
|
79
|
+
strIns += (section !== 0) ? chnUnitSection[unitPos] : chnUnitSection[0];
|
|
80
|
+
chnStr = strIns + chnStr;
|
|
81
|
+
needZero = (section < 1000) && (section > 0);
|
|
82
|
+
num = Math.floor(num / 10000);
|
|
83
|
+
unitPos++;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return chnStr;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function SectionToChinese(section){
|
|
90
|
+
var strIns = '', chnStr = '';
|
|
91
|
+
var unitPos = 0;
|
|
92
|
+
var zero = true;
|
|
93
|
+
while(section > 0){
|
|
94
|
+
var v = section % 10;
|
|
95
|
+
if(v === 0){
|
|
96
|
+
if(!zero){
|
|
97
|
+
zero = true;
|
|
98
|
+
chnStr = chnNumChar[v] + chnStr;
|
|
99
|
+
}
|
|
100
|
+
}else{
|
|
101
|
+
zero = false;
|
|
102
|
+
strIns = chnNumChar[v];
|
|
103
|
+
strIns += chnUnitChar[unitPos];
|
|
104
|
+
chnStr = strIns + chnStr;
|
|
105
|
+
}
|
|
106
|
+
unitPos++;
|
|
107
|
+
section = Math.floor(section / 10);
|
|
108
|
+
}
|
|
109
|
+
return chnStr;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function upperFirstLetter(str) {
|
|
113
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function formatList(list){
|
|
117
|
+
let seperator=','
|
|
118
|
+
return list ? list.join(seperator) : ''
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
// 删除url查询参数中的hash路径后缀
|
|
123
|
+
export function trimSuffixHashPath(str){
|
|
124
|
+
if(typeof str != 'string'){
|
|
125
|
+
console.error(`${typeof str} 不是字符串`)
|
|
126
|
+
return str
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// 若没有查询参数 不处理
|
|
130
|
+
let params = str.split('?')
|
|
131
|
+
if(params.length<2)
|
|
132
|
+
return str
|
|
133
|
+
|
|
134
|
+
// 剔除末尾的哈希路由
|
|
135
|
+
let path = params[0]
|
|
136
|
+
let paramStr = params[1]
|
|
137
|
+
let list = paramStr.split('#/')
|
|
138
|
+
if(list.length<2)
|
|
139
|
+
return str
|
|
140
|
+
else
|
|
141
|
+
paramStr = list[0]
|
|
142
|
+
|
|
143
|
+
return path + '?' + paramStr
|
|
144
|
+
}
|