Compare commits
21 Commits
8e94f1d7f2
...
224e4578db
Author | SHA1 | Date | |
---|---|---|---|
![]() |
224e4578db | ||
![]() |
8624b29d37 | ||
![]() |
3dd367c216 | ||
![]() |
aff8d2168a | ||
![]() |
71cdfa3116 | ||
8222fdc0a4 | |||
![]() |
7d871f7151 | ||
f50e2fe7ec | |||
![]() |
1dbe2fbd07 | ||
![]() |
d536aaad8a | ||
![]() |
ef66d42536 | ||
![]() |
3f29785a61 | ||
![]() |
45aa41d156 | ||
![]() |
3dc869143c | ||
![]() |
410769873a | ||
![]() |
d650513a5d | ||
a5d733a269 | |||
![]() |
911c4c365a | ||
![]() |
f0ae068474 | ||
![]() |
df0e9f3310 | ||
![]() |
a9ddf5324d |
@ -1,3 +1,4 @@
|
|||||||
# 开发环境
|
# 开发环境
|
||||||
# 请求接口地址
|
# 请求接口地址
|
||||||
VITE_REQUEST_BASE_URL = https://36.112.48.190
|
VITE_REQUEST_BASE_URL = https://36.112.48.190
|
||||||
|
#VITE_REQUEST_BASE_URL = http://10.75.15.247:8080
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
# 生产环境
|
# 生产环境
|
||||||
# 请求接口地址
|
# 请求接口地址
|
||||||
VITE_REQUEST_BASE_URL = https://36.112.48.190
|
#VITE_REQUEST_BASE_URL = https://36.112.48.190
|
||||||
|
VITE_REQUEST_BASE_URL = http://10.75.15.247:8080
|
12
.gitignore
vendored
12
.gitignore
vendored
@ -32,7 +32,7 @@
|
|||||||
/unpackage/cache/wgt/__UNI__9F097F0/pages/useredit/addressbook.css
|
/unpackage/cache/wgt/__UNI__9F097F0/pages/useredit/addressbook.css
|
||||||
/unpackage/cache/wgt/__UNI__9F097F0/pages/useredit/useredit.css
|
/unpackage/cache/wgt/__UNI__9F097F0/pages/useredit/useredit.css
|
||||||
/unpackage/cache/wgt/__UNI__9F097F0/pages/userlist/index.css
|
/unpackage/cache/wgt/__UNI__9F097F0/pages/userlist/index.css
|
||||||
/unpackage/cache/wgt/__UNI__9F097F0/pages/zhiban/index.css
|
/unpackage/cache/wgt/__UNI__9F097F0/pages/views/zhongheguanli/zhiban/index.css
|
||||||
/unpackage/dist/build/app-plus/__uniappautomator.js
|
/unpackage/dist/build/app-plus/__uniappautomator.js
|
||||||
/unpackage/dist/build/app-plus/__uniappchooselocation.js
|
/unpackage/dist/build/app-plus/__uniappchooselocation.js
|
||||||
/unpackage/dist/build/app-plus/app-config-service.js
|
/unpackage/dist/build/app-plus/app-config-service.js
|
||||||
@ -53,5 +53,13 @@
|
|||||||
/unpackage/dist/dev/app-plus/app.css
|
/unpackage/dist/dev/app-plus/app.css
|
||||||
/unpackage/dist/dev/app-plus/manifest.json
|
/unpackage/dist/dev/app-plus/manifest.json
|
||||||
/unpackage/dist/dev/app-plus/uni-app-view.umd.js
|
/unpackage/dist/dev/app-plus/uni-app-view.umd.js
|
||||||
|
/node_modules/.vite/deps/_metadata.json
|
||||||
|
/node_modules/.vite/deps/base-64.js
|
||||||
|
/node_modules/.vite/deps/base-64.js.map
|
||||||
|
/node_modules/.vite/deps/chunk-RSJERJUL.js
|
||||||
|
/node_modules/.vite/deps/chunk-RSJERJUL.js.map
|
||||||
|
/node_modules/.vite/deps/dayjs.js
|
||||||
|
/node_modules/.vite/deps/dayjs.js.map
|
||||||
|
/node_modules/.vite/deps/package.json
|
||||||
|
/uni_modules
|
||||||
/node_modules
|
/node_modules
|
||||||
/unpackage
|
|
||||||
|
26
.hbuilderx/launch.json
Normal file
26
.hbuilderx/launch.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
|
||||||
|
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
|
||||||
|
"version" : "0.0",
|
||||||
|
"configurations" : [
|
||||||
|
{
|
||||||
|
"app-plus" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"default" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"mp-weixin" :
|
||||||
|
{
|
||||||
|
"launchtype" : "local"
|
||||||
|
},
|
||||||
|
"type" : "uniCloud"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"playground" : "standard",
|
||||||
|
"type" : "uni-app:app-android"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
13
.vite/deps/_metadata.json
Normal file
13
.vite/deps/_metadata.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"hash": "5610b5a1",
|
||||||
|
"browserHash": "3deef0d9",
|
||||||
|
"optimized": {
|
||||||
|
"base-64": {
|
||||||
|
"src": "../../node_modules/base-64/base64.js",
|
||||||
|
"file": "base-64.js",
|
||||||
|
"fileHash": "768aae23",
|
||||||
|
"needsInterop": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chunks": {}
|
||||||
|
}
|
117
.vite/deps/base-64.js
Normal file
117
.vite/deps/base-64.js
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
var __commonJS = (cb, mod) => function __require() {
|
||||||
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ../../../../Documents/HBuilderProjects/B404219-tianranqi/node_modules/base-64/base64.js
|
||||||
|
var require_base64 = __commonJS({
|
||||||
|
"../../../../Documents/HBuilderProjects/B404219-tianranqi/node_modules/base-64/base64.js"(exports, module) {
|
||||||
|
(function(root) {
|
||||||
|
var freeExports = typeof exports == "object" && exports;
|
||||||
|
var freeModule = typeof module == "object" && module && module.exports == freeExports && module;
|
||||||
|
var freeGlobal = typeof global == "object" && global;
|
||||||
|
if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
|
||||||
|
root = freeGlobal;
|
||||||
|
}
|
||||||
|
var InvalidCharacterError = function(message) {
|
||||||
|
this.message = message;
|
||||||
|
};
|
||||||
|
InvalidCharacterError.prototype = new Error();
|
||||||
|
InvalidCharacterError.prototype.name = "InvalidCharacterError";
|
||||||
|
var error = function(message) {
|
||||||
|
throw new InvalidCharacterError(message);
|
||||||
|
};
|
||||||
|
var TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||||
|
var REGEX_SPACE_CHARACTERS = /[\t\n\f\r ]/g;
|
||||||
|
var decode = function(input) {
|
||||||
|
input = String(input).replace(REGEX_SPACE_CHARACTERS, "");
|
||||||
|
var length = input.length;
|
||||||
|
if (length % 4 == 0) {
|
||||||
|
input = input.replace(/==?$/, "");
|
||||||
|
length = input.length;
|
||||||
|
}
|
||||||
|
if (length % 4 == 1 || // http://whatwg.org/C#alphanumeric-ascii-characters
|
||||||
|
/[^+a-zA-Z0-9/]/.test(input)) {
|
||||||
|
error(
|
||||||
|
"Invalid character: the string to be decoded is not correctly encoded."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var bitCounter = 0;
|
||||||
|
var bitStorage;
|
||||||
|
var buffer;
|
||||||
|
var output = "";
|
||||||
|
var position = -1;
|
||||||
|
while (++position < length) {
|
||||||
|
buffer = TABLE.indexOf(input.charAt(position));
|
||||||
|
bitStorage = bitCounter % 4 ? bitStorage * 64 + buffer : buffer;
|
||||||
|
if (bitCounter++ % 4) {
|
||||||
|
output += String.fromCharCode(
|
||||||
|
255 & bitStorage >> (-2 * bitCounter & 6)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
var encode = function(input) {
|
||||||
|
input = String(input);
|
||||||
|
if (/[^\0-\xFF]/.test(input)) {
|
||||||
|
error(
|
||||||
|
"The string to be encoded contains characters outside of the Latin1 range."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
var padding = input.length % 3;
|
||||||
|
var output = "";
|
||||||
|
var position = -1;
|
||||||
|
var a;
|
||||||
|
var b;
|
||||||
|
var c;
|
||||||
|
var buffer;
|
||||||
|
var length = input.length - padding;
|
||||||
|
while (++position < length) {
|
||||||
|
a = input.charCodeAt(position) << 16;
|
||||||
|
b = input.charCodeAt(++position) << 8;
|
||||||
|
c = input.charCodeAt(++position);
|
||||||
|
buffer = a + b + c;
|
||||||
|
output += TABLE.charAt(buffer >> 18 & 63) + TABLE.charAt(buffer >> 12 & 63) + TABLE.charAt(buffer >> 6 & 63) + TABLE.charAt(buffer & 63);
|
||||||
|
}
|
||||||
|
if (padding == 2) {
|
||||||
|
a = input.charCodeAt(position) << 8;
|
||||||
|
b = input.charCodeAt(++position);
|
||||||
|
buffer = a + b;
|
||||||
|
output += TABLE.charAt(buffer >> 10) + TABLE.charAt(buffer >> 4 & 63) + TABLE.charAt(buffer << 2 & 63) + "=";
|
||||||
|
} else if (padding == 1) {
|
||||||
|
buffer = input.charCodeAt(position);
|
||||||
|
output += TABLE.charAt(buffer >> 2) + TABLE.charAt(buffer << 4 & 63) + "==";
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
};
|
||||||
|
var base64 = {
|
||||||
|
"encode": encode,
|
||||||
|
"decode": decode,
|
||||||
|
"version": "1.0.0"
|
||||||
|
};
|
||||||
|
if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
|
||||||
|
define(function() {
|
||||||
|
return base64;
|
||||||
|
});
|
||||||
|
} else if (freeExports && !freeExports.nodeType) {
|
||||||
|
if (freeModule) {
|
||||||
|
freeModule.exports = base64;
|
||||||
|
} else {
|
||||||
|
for (var key in base64) {
|
||||||
|
base64.hasOwnProperty(key) && (freeExports[key] = base64[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
root.base64 = base64;
|
||||||
|
}
|
||||||
|
})(exports);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
export default require_base64();
|
||||||
|
/*! Bundled license information:
|
||||||
|
|
||||||
|
base-64/base64.js:
|
||||||
|
(*! https://mths.be/base64 v1.0.0 by @mathias | MIT license *)
|
||||||
|
*/
|
||||||
|
//# sourceMappingURL=base-64.js.map
|
7
.vite/deps/base-64.js.map
Normal file
7
.vite/deps/base-64.js.map
Normal file
File diff suppressed because one or more lines are too long
3
.vite/deps/package.json
Normal file
3
.vite/deps/package.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
10
api/pages.js
10
api/pages.js
@ -27,3 +27,13 @@ export function qjQueryByIdApi(config) { // 通过id查询请假数据 流程用
|
|||||||
data: config
|
data: config
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function queryHisDateApi(username) { // 根据username获取最新请假结束日期
|
||||||
|
return https({
|
||||||
|
url: '/CxcQxj/cxcQxj/queryHisDate',
|
||||||
|
method: 'get',
|
||||||
|
data: {
|
||||||
|
username
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
@ -81,3 +81,19 @@ export function cxcRyDataTongji(url, parm) { // 员工信息统计
|
|||||||
data: parm
|
data: parm
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function cxcRyDatAstatistics(parm) { // 员工分组统计
|
||||||
|
return https({
|
||||||
|
url: '/cxc_rlzy.zb/cxcRlzyZb/statistics',
|
||||||
|
method: 'get',
|
||||||
|
data: parm
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function cxcRyDatAstatisticsDetails(parm) { // 员工信息统计
|
||||||
|
return https({
|
||||||
|
url: '/cxc_rlzy.zb/cxcRlzyZb/details',
|
||||||
|
method: 'get',
|
||||||
|
data: parm
|
||||||
|
})
|
||||||
|
}
|
149
manifest.json
149
manifest.json
@ -1,36 +1,36 @@
|
|||||||
{
|
{
|
||||||
"name": "数智产销",
|
"name" : "数智产销",
|
||||||
"appid": "__UNI__9F097F0",
|
"appid" : "__UNI__9F097F0",
|
||||||
"description": "",
|
"description" : "",
|
||||||
"versionName": "1.1.4.1",
|
"versionName" : "1.1.6",
|
||||||
"versionCode": 20250121,
|
"versionCode" : 20250207,
|
||||||
"transformPx": false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus": {
|
"app-plus" : {
|
||||||
"usingComponents": true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler": "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion": 3,
|
"compilerVersion" : 3,
|
||||||
"splashscreen": {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender": true,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting": true,
|
"waiting" : true,
|
||||||
"autoclose": true,
|
"autoclose" : true,
|
||||||
"delay": 0
|
"delay" : 0
|
||||||
},
|
},
|
||||||
"compatible": {
|
"compatible" : {
|
||||||
"ignoreVersion": true
|
"ignoreVersion" : true
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"modules": {
|
"modules" : {
|
||||||
"Geolocation": {},
|
"Geolocation" : {},
|
||||||
"Fingerprint": {},
|
"Fingerprint" : {},
|
||||||
"Camera": {},
|
"Camera" : {},
|
||||||
"Barcode": {}
|
"Barcode" : {}
|
||||||
},
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute": {
|
"distribute" : {
|
||||||
/* android打包配置 */
|
/* android打包配置 */
|
||||||
"android": {
|
"android" : {
|
||||||
"permissions": [
|
"permissions" : [
|
||||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
@ -49,74 +49,75 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios": {
|
"ios" : {
|
||||||
"dSYMs": false
|
"dSYMs" : false
|
||||||
},
|
},
|
||||||
/* SDK配置 */
|
/* SDK配置 */
|
||||||
"sdkConfigs": {
|
"sdkConfigs" : {
|
||||||
"ad": {},
|
"ad" : {},
|
||||||
"geolocation": {
|
"geolocation" : {
|
||||||
"system": {
|
"system" : {
|
||||||
"__platform__": ["android"]
|
"__platform__" : [ "android" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"icons": {
|
"icons" : {
|
||||||
"android": {
|
"android" : {
|
||||||
"hdpi": "unpackage/res/icons/72x72.png",
|
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||||
"xhdpi": "unpackage/res/icons/96x96.png",
|
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||||
"xxhdpi": "unpackage/res/icons/144x144.png",
|
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||||
"xxxhdpi": "unpackage/res/icons/192x192.png"
|
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||||
},
|
},
|
||||||
"ios": {
|
"ios" : {
|
||||||
"appstore": "unpackage/res/icons/1024x1024.png",
|
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||||
"ipad": {
|
"ipad" : {
|
||||||
"app": "unpackage/res/icons/76x76.png",
|
"app" : "unpackage/res/icons/76x76.png",
|
||||||
"app@2x": "unpackage/res/icons/152x152.png",
|
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||||
"notification": "unpackage/res/icons/20x20.png",
|
"notification" : "unpackage/res/icons/20x20.png",
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
"proapp@2x": "unpackage/res/icons/167x167.png",
|
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||||
"settings": "unpackage/res/icons/29x29.png",
|
"settings" : "unpackage/res/icons/29x29.png",
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
"spotlight": "unpackage/res/icons/40x40.png",
|
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png"
|
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||||
},
|
},
|
||||||
"iphone": {
|
"iphone" : {
|
||||||
"app@2x": "unpackage/res/icons/120x120.png",
|
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||||
"app@3x": "unpackage/res/icons/180x180.png",
|
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||||
"notification@3x": "unpackage/res/icons/60x60.png",
|
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||||
"settings@3x": "unpackage/res/icons/87x87.png",
|
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||||
"spotlight@2x": "unpackage/res/icons/80x80.png",
|
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||||
"spotlight@3x": "unpackage/res/icons/120x120.png"
|
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 快应用特有相关 */
|
/* 快应用特有相关 */
|
||||||
"quickapp": {},
|
"quickapp" : {},
|
||||||
/* 小程序特有相关 */
|
/* 小程序特有相关 */
|
||||||
"mp-weixin": {
|
"mp-weixin" : {
|
||||||
"appid": "",
|
"appid" : "",
|
||||||
"setting": {
|
"setting" : {
|
||||||
"urlCheck": false
|
"urlCheck" : false
|
||||||
},
|
},
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"mp-alipay": {
|
"mp-alipay" : {
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"mp-baidu": {
|
"mp-baidu" : {
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"mp-toutiao": {
|
"mp-toutiao" : {
|
||||||
"usingComponents": true
|
"usingComponents" : true
|
||||||
},
|
},
|
||||||
"uniStatistics": {
|
"uniStatistics" : {
|
||||||
"enable": false
|
"enable" : false
|
||||||
},
|
},
|
||||||
"vueVersion": "3"
|
"vueVersion" : "3"
|
||||||
}
|
}
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
|
|
||||||
|
@ -236,9 +236,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/views/renliziyuan/renyuanxinxi/xbtongji",
|
"path": "pages/views/renliziyuan/renyuanxinxi/qttongji",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "人员性别分组统计信息",
|
"navigationBarTitleText": "其他统计信息",
|
||||||
"navigationBarTextStyle": "white"
|
"navigationBarTextStyle": "white"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,8 @@
|
|||||||
} from '@/api/api.js';
|
} from '@/api/api.js';
|
||||||
import {
|
import {
|
||||||
qjAddApi,
|
qjAddApi,
|
||||||
queryZwmcAndExaApi
|
queryZwmcAndExaApi,
|
||||||
|
queryHisDateApi
|
||||||
} from '@/api/pages.js';
|
} from '@/api/pages.js';
|
||||||
import {
|
import {
|
||||||
queryDepByCode,
|
queryDepByCode,
|
||||||
@ -177,7 +178,7 @@
|
|||||||
}
|
}
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
loadData()
|
loadData()
|
||||||
getTomorrowDate()
|
// getTomorrowDate()
|
||||||
})
|
})
|
||||||
|
|
||||||
const select = (e) => {
|
const select = (e) => {
|
||||||
@ -274,21 +275,39 @@
|
|||||||
proxy.$toast(res.message);
|
proxy.$toast(res.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
queryHisDateApi(store.userinfo.username).then((res) => { // 最新请假结束日期
|
||||||
|
if (res) {
|
||||||
|
console.log('--0', res)
|
||||||
|
getTomorrowDate(res);
|
||||||
|
} else {
|
||||||
|
console.log('--1', res)
|
||||||
|
getTomorrowDate();
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const bindType = (e) => {
|
const bindType = (e) => {
|
||||||
typeIndex.value = e.detail.value
|
typeIndex.value = e.detail.value
|
||||||
}
|
}
|
||||||
|
|
||||||
const getTomorrowDate = () => {
|
const getTomorrowDate = (e) => {
|
||||||
let today = new Date();
|
let tomorrow;
|
||||||
let tomorrow = new Date(today);
|
if (e) {
|
||||||
tomorrow.setDate(today.getDate() + 1);
|
// 将传入的日期字符串转换为Date对象
|
||||||
// 格式化日期为 yyyy-mm-dd
|
const dateParts = e.split('-').map(Number);
|
||||||
let year = tomorrow.getFullYear();
|
tomorrow = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]);
|
||||||
let month = String(tomorrow.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1
|
} else {
|
||||||
let day = String(tomorrow.getDate()).padStart(2, '0');
|
// 如果没有提供日期,则使用当前日期
|
||||||
beginTime.value = year + '-' + month + '-' + day;
|
tomorrow = new Date();
|
||||||
|
}
|
||||||
|
// 设置为明天的日期
|
||||||
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
||||||
|
// 格式化日期
|
||||||
|
const year = tomorrow.getFullYear();
|
||||||
|
const month = (tomorrow.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
const day = tomorrow.getDate().toString().padStart(2, '0');
|
||||||
|
beginTime.value = `${year}-${month}-${day}`;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,212 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view :class="['content',{'gray':store.isgray==1}]">
|
|
||||||
<view class="list_box">
|
|
||||||
<view class="list">
|
|
||||||
<view class="title f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
年度部门讨论会议
|
|
||||||
</view>
|
|
||||||
<text>1分钟前</text>
|
|
||||||
</view>
|
|
||||||
<view class="info">
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
会议状态:
|
|
||||||
</view>
|
|
||||||
<text>待开始/已开始/已结束</text>
|
|
||||||
</view>
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
发起人:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
会议日期:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
会议地点:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
会议内容:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
<view class="">
|
|
||||||
<view class="">
|
|
||||||
参与人员:
|
|
||||||
</view>
|
|
||||||
<view class="person f-row aic">
|
|
||||||
<view class="item f-col aic" v-for="item,i in 7" :key="i">
|
|
||||||
<image src="" mode=""></image>
|
|
||||||
<view class="name">
|
|
||||||
周如意
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="btn f-row aic jcb">
|
|
||||||
<view class="refuse">
|
|
||||||
拒绝
|
|
||||||
</view>
|
|
||||||
<view class="agree" @click="openpop">
|
|
||||||
同意
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import {
|
|
||||||
ref
|
|
||||||
} from 'vue';
|
|
||||||
import {
|
|
||||||
huiyiDetailApi
|
|
||||||
} from '@/api/api.js';
|
|
||||||
import {
|
|
||||||
onLoad
|
|
||||||
} from '@dcloudio/uni-app';
|
|
||||||
import {
|
|
||||||
useStore
|
|
||||||
} from '@/store'
|
|
||||||
const store = useStore()
|
|
||||||
onLoad(() => {
|
|
||||||
huiyiDetail()
|
|
||||||
})
|
|
||||||
const huiyiDetail = () => {
|
|
||||||
huiyiDetailApi({
|
|
||||||
mainid:1
|
|
||||||
}).then((res) => {
|
|
||||||
if (res.success) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.content{
|
|
||||||
padding-bottom: 120rpx;
|
|
||||||
}
|
|
||||||
.btn {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
width: 690rpx;
|
|
||||||
height: 120rpx;
|
|
||||||
background: #FFFFFF;
|
|
||||||
padding: 0 30rpx;
|
|
||||||
border-top: 1px solid #EFEFEF;
|
|
||||||
|
|
||||||
view {
|
|
||||||
|
|
||||||
width: 330rpx;
|
|
||||||
height: 88rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
border-radius: 16rpx;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 88rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.refuse {
|
|
||||||
box-sizing: border-box;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border: 2rpx solid #01508B;
|
|
||||||
color: #01508B;
|
|
||||||
}
|
|
||||||
|
|
||||||
.agree {
|
|
||||||
background: #01508B;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.list_box {
|
|
||||||
|
|
||||||
.list {
|
|
||||||
padding: 30rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
|
|
||||||
.title {
|
|
||||||
border-bottom: 1px solid #efefef;
|
|
||||||
padding-bottom: 24rpx;
|
|
||||||
margin-bottom: 8rpx;
|
|
||||||
|
|
||||||
view {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #666666;
|
|
||||||
|
|
||||||
view {
|
|
||||||
padding-top: 16rpx;
|
|
||||||
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #666666;
|
|
||||||
}
|
|
||||||
text{
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
.person{
|
|
||||||
flex-wrap: wrap;
|
|
||||||
.item{
|
|
||||||
width: 16.66%;
|
|
||||||
|
|
||||||
}
|
|
||||||
image{
|
|
||||||
width: 78rpx;
|
|
||||||
height: 78rpx;
|
|
||||||
border-radius: 38rpx;
|
|
||||||
background-color: #01508B;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
margin-top: 30rpx;
|
|
||||||
|
|
||||||
view {
|
|
||||||
width: 300rpx;
|
|
||||||
height: 64rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 64rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.entrust {
|
|
||||||
background: #FFFFFF;
|
|
||||||
border: 2rpx solid #01508B;
|
|
||||||
box-sizing: border-box;
|
|
||||||
color: #01508B;
|
|
||||||
}
|
|
||||||
|
|
||||||
.handle {
|
|
||||||
background: #01508B;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,247 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view :class="{'gray':store.isgray==1}">
|
|
||||||
<customNav>
|
|
||||||
<view class="nav_box f-row aic jcb">
|
|
||||||
<view class="back f-row aic" @click="back">
|
|
||||||
<uni-icons type="left" size="20" color="#fff"></uni-icons>
|
|
||||||
</view>
|
|
||||||
<view class="search f-row aic">
|
|
||||||
<input type="text" v-model="searchKey" @confirm="search" @blur="showicon=true&&!searchKey"
|
|
||||||
@focus="showicon=false" />
|
|
||||||
<view class="f-row aic" v-if="showicon">
|
|
||||||
<image src="../../static/search.png" mode=""></image>
|
|
||||||
<text>搜索</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</customNav>
|
|
||||||
<view class="list_box">
|
|
||||||
<view class="list" v-for="item,i in 3" :key="i" @click="jump(`/pages/meeting/detail?id=1`)">
|
|
||||||
<view class="title f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
年度部门讨论会议
|
|
||||||
</view>
|
|
||||||
<text>1分钟前</text>
|
|
||||||
</view>
|
|
||||||
<view class="info">
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
发起人:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
会议日期:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
会议地点:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
<view class="f-row aic jcb">
|
|
||||||
<view class="">
|
|
||||||
会议内容:
|
|
||||||
</view>
|
|
||||||
<text>周如意</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- <view class="btn f-row aic jcb">
|
|
||||||
<view class="entrust">
|
|
||||||
拒绝
|
|
||||||
</view>
|
|
||||||
<view class="handle">
|
|
||||||
同意
|
|
||||||
</view>
|
|
||||||
</view> -->
|
|
||||||
<view class="handled f-row">
|
|
||||||
<view class="refused">
|
|
||||||
已拒绝
|
|
||||||
</view>
|
|
||||||
<!-- <view class="agreed">
|
|
||||||
已同意
|
|
||||||
</view> -->
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import {
|
|
||||||
ref
|
|
||||||
} from 'vue';
|
|
||||||
import {
|
|
||||||
useStore
|
|
||||||
} from '@/store'
|
|
||||||
const store = useStore()
|
|
||||||
import {
|
|
||||||
huiyilistApi
|
|
||||||
} from '@/api/api.js';
|
|
||||||
import customNav from '../../bpm/customNav.vue';
|
|
||||||
import {
|
|
||||||
onLoad
|
|
||||||
} from '@dcloudio/uni-app';
|
|
||||||
import {
|
|
||||||
beforeJump
|
|
||||||
} from '@/utils/index.js';
|
|
||||||
const showicon = ref(true)
|
|
||||||
const searchKey = ref('')
|
|
||||||
onLoad(() => {
|
|
||||||
// huiyilist()
|
|
||||||
})
|
|
||||||
const huiyilist = () => {
|
|
||||||
huiyilistApi().then((res) => {
|
|
||||||
if (res.success) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const jump = (url) => {
|
|
||||||
beforeJump(url, () => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const back = () => {
|
|
||||||
uni.navigateBack()
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.nav_box {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 14rpx;
|
|
||||||
width: 100%;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.back {
|
|
||||||
padding: 0 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search {
|
|
||||||
position: relative;
|
|
||||||
padding-right: 30rpx;
|
|
||||||
flex: 1;
|
|
||||||
|
|
||||||
view {
|
|
||||||
position: absolute;
|
|
||||||
left: 28rpx;
|
|
||||||
top: 50%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999999;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
input {
|
|
||||||
flex: 1;
|
|
||||||
height: 72rpx;
|
|
||||||
background: #F8F8F8;
|
|
||||||
border-radius: 44rpx;
|
|
||||||
padding: 0 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
image {
|
|
||||||
width: 34rpx;
|
|
||||||
height: 34rpx;
|
|
||||||
margin-right: 16rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.list_box {
|
|
||||||
padding: 14rpx 30rpx 0 30rpx;
|
|
||||||
margin-top: 24rpx;
|
|
||||||
|
|
||||||
.list {
|
|
||||||
background: #FFFFFF;
|
|
||||||
box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0, 0, 0, 0.5);
|
|
||||||
border-radius: 16rpx;
|
|
||||||
padding: 30rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
|
|
||||||
.title {
|
|
||||||
border-bottom: 1px solid #efefef;
|
|
||||||
padding-bottom: 24rpx;
|
|
||||||
margin-bottom: 8rpx;
|
|
||||||
|
|
||||||
view {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
text {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #999999;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.info {
|
|
||||||
font-size: 28rpx;
|
|
||||||
color: #666666;
|
|
||||||
|
|
||||||
view {
|
|
||||||
padding-top: 16rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
margin-top: 30rpx;
|
|
||||||
|
|
||||||
view {
|
|
||||||
width: 300rpx;
|
|
||||||
height: 64rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 64rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.entrust {
|
|
||||||
background: #FFFFFF;
|
|
||||||
border: 2rpx solid #01508B;
|
|
||||||
box-sizing: border-box;
|
|
||||||
color: #01508B;
|
|
||||||
}
|
|
||||||
|
|
||||||
.handle {
|
|
||||||
background: #01508B;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.refused {
|
|
||||||
|
|
||||||
color: #333333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.agreed {
|
|
||||||
|
|
||||||
color: #01508B;
|
|
||||||
}
|
|
||||||
|
|
||||||
.handled {
|
|
||||||
justify-content: flex-end;
|
|
||||||
margin-top: 30rpx;
|
|
||||||
|
|
||||||
view {
|
|
||||||
width: 150rpx;
|
|
||||||
height: 64rpx;
|
|
||||||
background: #EFEFEF;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 64rpx;
|
|
||||||
font-size: 28rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -20,7 +20,9 @@
|
|||||||
</view>
|
</view>
|
||||||
</customNav>
|
</customNav>
|
||||||
<component :is="comp" :dataId="dataId"></component>
|
<component :is="comp" :dataId="dataId"></component>
|
||||||
<view class="btn f-row aic jcb" v-if="type == 0">
|
<view v-if="ifShow" style="display: block; margin: 10px;">
|
||||||
|
温馨提示:目前APP暂不支持电子签章审批,请登录PC端厂综合管理平台(https://10.75.166.6),在个人办公-我的任务中审批。</view>
|
||||||
|
<view class="btn f-row aic jcb" v-if="type == 0 && !ifShow">
|
||||||
<view class="refuse" @click="openpop(1)">
|
<view class="refuse" @click="openpop(1)">
|
||||||
拒绝
|
拒绝
|
||||||
</view>
|
</view>
|
||||||
@ -28,7 +30,6 @@
|
|||||||
同意
|
同意
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<uni-popup ref="popup" type="center">
|
<uni-popup ref="popup" type="center">
|
||||||
<view class="popup">
|
<view class="popup">
|
||||||
<view class="title">
|
<view class="title">
|
||||||
@ -110,6 +111,7 @@
|
|||||||
}
|
}
|
||||||
const comp = ref(null)
|
const comp = ref(null)
|
||||||
const dataId = ref('')
|
const dataId = ref('')
|
||||||
|
const ifShow = ref(false) //20250122 判断是否是签章业务 提示文字
|
||||||
const getProcessNodeInfo = (taskId) => {
|
const getProcessNodeInfo = (taskId) => {
|
||||||
getProcessNodeInfoApi({
|
getProcessNodeInfoApi({
|
||||||
taskId
|
taskId
|
||||||
@ -149,6 +151,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**流程办理接口*/
|
/**流程办理接口*/
|
||||||
const processComplete = (params) => {
|
const processComplete = (params) => {
|
||||||
processCompleteApi({
|
processCompleteApi({
|
||||||
@ -165,7 +168,6 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**审批流程节点*/
|
/**审批流程节点*/
|
||||||
const stepNode = ref([])
|
const stepNode = ref([])
|
||||||
/**当前选择的节点*/
|
/**当前选择的节点*/
|
||||||
@ -185,6 +187,7 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**历史任务详情*/
|
/**历史任务详情*/
|
||||||
const getHisProcessNodeInfo = (procInstId) => {
|
const getHisProcessNodeInfo = (procInstId) => {
|
||||||
getHisProcessNodeInfoApi({
|
getHisProcessNodeInfoApi({
|
||||||
@ -196,6 +199,18 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
/**判断是否是电子签章节点任务,是则显示温馨提示并隐藏审批按钮*/
|
||||||
|
const getIfShow = () => {
|
||||||
|
if (taskInfo.value.taskId == 'task1705482211321' || taskInfo.value.taskId == 'task1705482639673' ||
|
||||||
|
taskInfo.value.taskId == 'task1714092890849' || taskInfo.value.taskId == 'task1714092955682' ||
|
||||||
|
taskInfo.value.taskId == 'task1689151174324' || taskInfo.value.taskId == 'task1677809773570' ||
|
||||||
|
taskInfo.value.taskId == 'task1689579219152')
|
||||||
|
{ // 签章业务:非常规 承包商资质审查 招标采购 公务接待 房屋租赁
|
||||||
|
ifShow.value = true;
|
||||||
|
} else {
|
||||||
|
ifShow.value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
const taskInfo = ref(null)
|
const taskInfo = ref(null)
|
||||||
let type = null
|
let type = null
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
@ -207,6 +222,8 @@
|
|||||||
getProcessNodeInfo(taskInfo.value.id)
|
getProcessNodeInfo(taskInfo.value.id)
|
||||||
getProcessTaskTransInfo()
|
getProcessTaskTransInfo()
|
||||||
|
|
||||||
|
getIfShow()
|
||||||
|
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
@ -8,31 +8,37 @@
|
|||||||
</uni-section>
|
</uni-section>
|
||||||
<uni-section title="统计信息" type="line">
|
<uni-section title="统计信息" type="line">
|
||||||
<uni-card :is-shadow="false">
|
<uni-card :is-shadow="false">
|
||||||
<button type="primary" @click="toTongji">年龄分组统计</button>
|
<button type="primary" @click="toTongji">年龄段统计</button>
|
||||||
<button type="primary" @click="toXbTongji">性别分组统计</button>
|
</uni-card>
|
||||||
|
|
||||||
|
<uni-card :is-shadow="false">
|
||||||
|
<button type="primary" @click="toQtTongji">其他统计</button>
|
||||||
</uni-card>
|
</uni-card>
|
||||||
</uni-section>
|
</uni-section>
|
||||||
</uni-card>
|
</uni-card>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
function toTaizhang() {
|
function toTaizhang() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/views/renliziyuan/renyuanxinxi/taizhang'
|
url: "/pages/views/renliziyuan/renyuanxinxi/taizhang"
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function toTongji() {
|
function toTongji() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/views/renliziyuan/renyuanxinxi/tongji'
|
url: "/pages/views/renliziyuan/renyuanxinxi/tongji"
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
function toXbTongji() {
|
|
||||||
|
function toQtTongji() {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/views/renliziyuan/renyuanxinxi/xbtongji'
|
url: "/pages/views/renliziyuan/renyuanxinxi/qttongji"
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style>
|
||||||
|
</style>
|
348
pages/views/renliziyuan/renyuanxinxi/qttongji.vue
Normal file
348
pages/views/renliziyuan/renyuanxinxi/qttongji.vue
Normal file
@ -0,0 +1,348 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="container" id="top1">
|
||||||
|
<uni-row style="margin-bottom: 10rpx;margin-left: 30rpx;margin-right: 30rpx;">
|
||||||
|
<uni-col :span="24"><uni-title :title="'所选单位ID'" align="left" type="h4"></uni-title></uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row style="margin-bottom: 20rpx;margin-left: 30rpx;margin-right: 30rpx;">
|
||||||
|
<uni-col :span="24">
|
||||||
|
<trq-depart-select v-model="selectedOrgCode" returnCodeOrID="orgCode"
|
||||||
|
@change="onOrgCodeChange"></trq-depart-select>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
|
||||||
|
<uni-row style="margin-bottom: 20rpx;margin-left: 30rpx;margin-right: 30rpx;">
|
||||||
|
<uni-col :span="24">
|
||||||
|
<picker mode="selector" :range="fieldList" range-key="label" @change="onFieldChange">
|
||||||
|
<view class="picker">选择字段: {{ selectedFieldLabel }}</view>
|
||||||
|
</picker>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<!-- ECharts图表 -->
|
||||||
|
<view class="chart-container">
|
||||||
|
<l-echart ref="chart" @finished="initChart" @tap="onChartClick" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
|
||||||
|
<uni-row style="margin-top: 10px; margin-left: 30rpx;margin-right: 30rpx;" v-if="personnelList.length>0">
|
||||||
|
<uni-col :span="3">
|
||||||
|
<view class="titleStyle">
|
||||||
|
序号
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5">
|
||||||
|
<view class="titleStyle">
|
||||||
|
姓名
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5">
|
||||||
|
<view class="titleStyle">
|
||||||
|
性别
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5">
|
||||||
|
<view class="titleStyle">
|
||||||
|
年龄
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="6">
|
||||||
|
<view class="titleStyle">
|
||||||
|
操作
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
|
||||||
|
<scroll-view scroll-y :style="{height: bottomHeight + 'px' }">
|
||||||
|
<uni-row style="margin-bottom: 10rpx;margin-left: 30rpx;margin-right: 30rpx;">
|
||||||
|
<view v-for="(item,index) in personnelList">
|
||||||
|
<uni-col :span="3">
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{index+1}}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5">
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{item.xm}}
|
||||||
|
</view>
|
||||||
|
</uni-col><uni-col :span="5">
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{item.xb_dictText}}
|
||||||
|
</view>
|
||||||
|
</uni-col><uni-col :span="5">
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{item.nl}}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="6">
|
||||||
|
<view class="dataStyle">
|
||||||
|
<button size="mini" type="primary" @click="detail(item)">详情</button>
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
</view>
|
||||||
|
</uni-row>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
onMounted
|
||||||
|
} from 'vue';
|
||||||
|
import * as echarts from 'echarts';
|
||||||
|
import {
|
||||||
|
cxcRyDatAstatistics,
|
||||||
|
cxcRyDatAstatisticsDetails
|
||||||
|
} from '@/api/renyuan.js';
|
||||||
|
// 存储下方组件的高度 tableData
|
||||||
|
const bottomHeight = ref(0);
|
||||||
|
// 新增加载状态
|
||||||
|
const chart = ref(null);
|
||||||
|
const fieldList = ref([{
|
||||||
|
label: '性别',
|
||||||
|
value: 'xb'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '年龄',
|
||||||
|
value: 'nl'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '学历',
|
||||||
|
value: 'whcd1'
|
||||||
|
},
|
||||||
|
]); // 字段列表
|
||||||
|
const selectedOrgCode = ref(''); // 当前选择的单位 orgCode
|
||||||
|
const selectedOrgCodeLabel = ref('请选择单位'); // 当前选择的单位名称
|
||||||
|
const selectedField = ref(''); // 当前选择的字段
|
||||||
|
const selectedFieldLabel = ref('请选择字段'); // 当前选择的字段名称
|
||||||
|
const chartData = ref({}); // 图表数据
|
||||||
|
const personnelList = ref([]); // 人员列表 initChart
|
||||||
|
|
||||||
|
const chartOption = ref({
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis',
|
||||||
|
axisPointer: {
|
||||||
|
type: 'shadow',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
xAxis: {
|
||||||
|
type: 'category',
|
||||||
|
data: [],
|
||||||
|
},
|
||||||
|
yAxis: {
|
||||||
|
type: 'value',
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '数量',
|
||||||
|
type: 'bar',
|
||||||
|
data: [],
|
||||||
|
}, ],
|
||||||
|
})
|
||||||
|
|
||||||
|
function detail(record) {
|
||||||
|
// console.log(record)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/views/renliziyuan/renyuanxinxi/detail?data=" + encodeURIComponent(JSON.stringify(record))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// #ifdef APP
|
||||||
|
getHeight();
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
// #ifdef APP
|
||||||
|
|
||||||
|
const getHeight = () => {
|
||||||
|
// 获取屏幕高度
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
const screenHeight = systemInfo.screenHeight;
|
||||||
|
// 创建选择器查询对象
|
||||||
|
const query = uni.createSelectorQuery();
|
||||||
|
// 获取上方组件的高度
|
||||||
|
query
|
||||||
|
.select('#top1')
|
||||||
|
.boundingClientRect((rect1) => {
|
||||||
|
// 计算上方组件高度总和
|
||||||
|
const topComponentsHeight = rect1.height
|
||||||
|
// 计算下方组件的高度
|
||||||
|
bottomHeight.value = screenHeight - topComponentsHeight - 415;
|
||||||
|
})
|
||||||
|
.exec();
|
||||||
|
};
|
||||||
|
|
||||||
|
// #endif
|
||||||
|
// 初始化 ECharts length departChange
|
||||||
|
// 初始化图表
|
||||||
|
const initChart = () => {
|
||||||
|
setTimeout(async () => {
|
||||||
|
if (!chart.value) return
|
||||||
|
const myChart = await chart.value.init(echarts)
|
||||||
|
myChart.setOption(chartOption.value)
|
||||||
|
}, 300)
|
||||||
|
};
|
||||||
|
|
||||||
|
// 更新图表
|
||||||
|
const updateChart = () => {
|
||||||
|
if (!chart) return;
|
||||||
|
const {
|
||||||
|
xb,
|
||||||
|
number
|
||||||
|
} = chartData.value;
|
||||||
|
chart.setOption({
|
||||||
|
xAxis: {
|
||||||
|
data: xb,
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
data: number,
|
||||||
|
}, ],
|
||||||
|
});
|
||||||
|
};
|
||||||
|
// 获取统计数据
|
||||||
|
const fetchStatisticsData = async () => {
|
||||||
|
if (!selectedOrgCode.value || !selectedField.value) return;
|
||||||
|
try {
|
||||||
|
const res = await cxcRyDatAstatistics({
|
||||||
|
orgCode: selectedOrgCode.value,
|
||||||
|
field: selectedField.value,
|
||||||
|
});
|
||||||
|
console.log(res)
|
||||||
|
chartData.value = res.data;
|
||||||
|
updateChart();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取统计数据失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取人员列表 delimiter
|
||||||
|
const fetchPersonnelList = async (ldhthList) => {
|
||||||
|
try {
|
||||||
|
const res = await cxcRyDatAstatisticsDetails({
|
||||||
|
ldhth: ldhthList
|
||||||
|
});
|
||||||
|
console.log(res)
|
||||||
|
personnelList.value = res.data;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取人员列表失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 事件处理
|
||||||
|
const onOrgCodeChange = (e) => {
|
||||||
|
console.log(e)
|
||||||
|
selectedOrgCode.value = e;
|
||||||
|
fetchStatisticsData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFieldChange = (e) => {
|
||||||
|
const index = e.detail.value;
|
||||||
|
selectedField.value = fieldList.value[index].value;
|
||||||
|
selectedFieldLabel.value = fieldList.value[index].label;
|
||||||
|
fetchStatisticsData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChartClick = (e) => {
|
||||||
|
const {
|
||||||
|
ldhth
|
||||||
|
} = chartData.value;
|
||||||
|
if (ldhth && ldhth.length > 0) {
|
||||||
|
fetchPersonnelList(ldhth);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.container {
|
||||||
|
margin: 20, 20, 20, 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 20rpx;
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input {
|
||||||
|
flex: 1;
|
||||||
|
border: 1rpx solid #ddd;
|
||||||
|
padding: 15rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.query-btn {
|
||||||
|
background: #007AFF;
|
||||||
|
color: white;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
margin: 30rpx 0;
|
||||||
|
padding: 20rpx;
|
||||||
|
background: #f8f8f8;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.value {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #0000ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-container {
|
||||||
|
height: 400rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.titleStyle {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #747474;
|
||||||
|
line-height: 30px;
|
||||||
|
height: 30px;
|
||||||
|
background: #F2F9FC;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
border-left: 1px solid #919191;
|
||||||
|
border-bottom: 1px solid #919191;
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 内容样式 */
|
||||||
|
.dataStyle {
|
||||||
|
max-font-size: 14px;
|
||||||
|
/* 最大字体限制 */
|
||||||
|
min-font-size: 10px;
|
||||||
|
/* 最小字体限制 */
|
||||||
|
font-size: 12px;
|
||||||
|
color: #00007f;
|
||||||
|
line-height: 30px;
|
||||||
|
height: 30px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
border-bottom: 1px solid #919191;
|
||||||
|
border-left: 1px solid #919191;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,17 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<view class="container" id="top1">
|
<view class="container" id="top1">
|
||||||
<uni-row style="margin-bottom: 10rpx; margin-left: 30rpx; margin-right: 30rpx">
|
<uni-row style="margin-bottom: 10rpx;margin-left: 30rpx;margin-right: 30rpx;">
|
||||||
<uni-col :span="24"><uni-title :title="'所选单位ID:' + orgCode" align="left" type="h4"></uni-title></uni-col>
|
<uni-col :span="24"><uni-title :title="'所选单位ID:'+orgCode" align="left" type="h4"></uni-title></uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row style="margin-bottom: 20rpx; margin-left: 30rpx; margin-right: 30rpx">
|
<uni-row style="margin-bottom: 20rpx;margin-left: 30rpx;margin-right: 30rpx;">
|
||||||
<uni-col :span="24">
|
<uni-col :span="24">
|
||||||
<trq-depart-select v-model="orgCode" returnCodeOrID="orgCode" @change="departChange"></trq-depart-select>
|
<trq-depart-select v-model="orgCode" returnCodeOrID="orgCode"
|
||||||
|
@change="departChange"></trq-depart-select>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<!-- 概览统计 -->
|
<!-- 概览统计 -->
|
||||||
<view class="stats-box" v-if="summary.total">
|
<view class="stats-box" v-if="summary.total">
|
||||||
<view class="stat-item">
|
<view class=" stat-item">
|
||||||
<text class="label">总人数</text>
|
<text class="label">总人数</text>
|
||||||
<text class="value">{{ summary.total }}</text>
|
<text class="value">{{ summary.total }}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -26,47 +27,56 @@
|
|||||||
<l-echart ref="chart" @finished="initChart" />
|
<l-echart ref="chart" @finished="initChart" />
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
<!-- 数据表格 -->
|
<!-- 数据表格 -->
|
||||||
|
|
||||||
<uni-row style="margin-top: 10px; margin-left: 30rpx; margin-right: 30rpx" v-if="tableData.length > 0">
|
<uni-row style="margin-top: 10px; margin-left: 30rpx;margin-right: 30rpx;" v-if="tableData.length>0">
|
||||||
<uni-col :span="3">
|
<uni-col :span="3">
|
||||||
<view class="titleStyle">序号</view>
|
<view class="titleStyle">
|
||||||
|
序号
|
||||||
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="5">
|
<uni-col :span="5">
|
||||||
<view class="titleStyle">姓名</view>
|
<view class="titleStyle">
|
||||||
|
姓名
|
||||||
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="5">
|
<uni-col :span="5">
|
||||||
<view class="titleStyle">性别</view>
|
<view class="titleStyle">
|
||||||
|
性别
|
||||||
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="5">
|
<uni-col :span="5">
|
||||||
<view class="titleStyle">年龄</view>
|
<view class="titleStyle">
|
||||||
|
年龄
|
||||||
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="titleStyle">操作</view>
|
<view class="titleStyle">
|
||||||
|
操作
|
||||||
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
|
|
||||||
<scroll-view scroll-y :style="{ height: bottomHeight + 'px' }">
|
<scroll-view scroll-y :style="{height: bottomHeight + 'px' }">
|
||||||
<uni-row style="margin-bottom: 10rpx; margin-left: 30rpx; margin-right: 30rpx">
|
<uni-row style="margin-bottom: 10rpx;margin-left: 30rpx;margin-right: 30rpx;">
|
||||||
<view v-for="(item, index) in tableData">
|
<view v-for="(item,index) in tableData">
|
||||||
<uni-col :span="3">
|
<uni-col :span="3">
|
||||||
<view class="dataStyle">
|
<view class="dataStyle">
|
||||||
{{ index + 1 }}
|
{{index+1}}
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="5">
|
<uni-col :span="5">
|
||||||
<view class="dataStyle">
|
<view class="dataStyle">
|
||||||
{{ item.xm }}
|
{{item.xm}}
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col><uni-col :span="5">
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="dataStyle">
|
<view class="dataStyle">
|
||||||
{{ item.xb_dictText }}
|
{{item.xb_dictText}}
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col><uni-col :span="5">
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="dataStyle">
|
<view class="dataStyle">
|
||||||
{{ item.nl }}
|
{{item.nl}}
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
@ -74,43 +84,52 @@
|
|||||||
<button size="mini" type="primary" @click="detail(item)">详情</button>
|
<button size="mini" type="primary" @click="detail(item)">详情</button>
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</uni-row>
|
</uni-row>
|
||||||
|
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
import {
|
||||||
import * as echarts from 'echarts';
|
ref,
|
||||||
|
reactive,
|
||||||
|
onMounted
|
||||||
|
} from 'vue';
|
||||||
|
import * as echarts from 'echarts'
|
||||||
|
|
||||||
import { queryRenyuanByDepartID } from '@/api/renyuan.js';
|
import {
|
||||||
|
queryRenyuanByDepartID
|
||||||
|
} from '@/api/renyuan.js'
|
||||||
|
|
||||||
// 存储下方组件的高度
|
// 存储下方组件的高度
|
||||||
const bottomHeight = ref(0);
|
const bottomHeight = ref(0);
|
||||||
// 新增加载状态
|
// 新增加载状态
|
||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
const orgCode = ref('');
|
const orgCode = ref('');
|
||||||
const rawData = ref([]);
|
const rawData = ref([]);
|
||||||
const tableData = ref([]);
|
const tableData = ref([]);
|
||||||
const summary = reactive({
|
const summary = reactive({
|
||||||
total: 0,
|
total: 0,
|
||||||
avgAge: 0
|
avgAge: 0
|
||||||
});
|
});
|
||||||
const chart = ref(null);
|
const chart = ref(null);
|
||||||
const chartOption = ref({});
|
const chartOption = ref({});
|
||||||
const drillPopup = ref(null);
|
const drillPopup = ref(null);
|
||||||
const drillList = ref([]);
|
const drillList = ref([]);
|
||||||
const drillTitle = ref('');
|
const drillTitle = ref('');
|
||||||
|
|
||||||
function detail(record) {
|
function detail(record) {
|
||||||
// console.log(record)
|
// console.log(record)
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/views/renliziyuan/renyuanxinxi/detail?data=' + encodeURIComponent(JSON.stringify(record))
|
url: "/pages/views/renliziyuan/renyuanxinxi/detail?data=" + encodeURIComponent(JSON.stringify(record))
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
// 计算年龄initChart
|
// 计算年龄initChart
|
||||||
const calculateAge = (birthDate) => {
|
const calculateAge = (birthDate) => {
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
const birth = new Date(birthDate);
|
const birth = new Date(birthDate);
|
||||||
let age = today.getFullYear() - birth.getFullYear();
|
let age = today.getFullYear() - birth.getFullYear();
|
||||||
@ -119,18 +138,20 @@ const calculateAge = (birthDate) => {
|
|||||||
age--;
|
age--;
|
||||||
}
|
}
|
||||||
return age;
|
return age;
|
||||||
};
|
};
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const departChange = async (e, data) => {
|
const departChange = async (e, data) => {
|
||||||
tableData.value = [];
|
|
||||||
console.log(e);
|
tableData.value = []
|
||||||
|
console.log(e)
|
||||||
orgCode.value = e;
|
orgCode.value = e;
|
||||||
try {
|
try {
|
||||||
// 显示加载状态
|
// 显示加载状态
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
if (orgCode.value.length <= 6) {
|
if (orgCode.value.length <= 6) {
|
||||||
console.log(123242353);
|
|
||||||
|
console.log(123242353)
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '全厂数据较多,耐心等待数据加载中...',
|
title: '全厂数据较多,耐心等待数据加载中...',
|
||||||
mask: true
|
mask: true
|
||||||
@ -147,28 +168,31 @@ const departChange = async (e, data) => {
|
|||||||
fields: ['xm', 'nl', 'xb', 'xb_dictText', 'orgCode', 'jcdw', 'jcxd', 'jcxdCode']
|
fields: ['xm', 'nl', 'xb', 'xb_dictText', 'orgCode', 'jcdw', 'jcxd', 'jcxdCode']
|
||||||
};
|
};
|
||||||
if (orgCode.value.length <= 9) {
|
if (orgCode.value.length <= 9) {
|
||||||
params.orgCode = orgCode.value;
|
params.orgCode = orgCode.value
|
||||||
} else {
|
} else {
|
||||||
params.jcxd_code = orgCode.value;
|
params.jcxd_code = orgCode.value
|
||||||
|
|
||||||
}
|
}
|
||||||
queryRenyuanByDepartID(params)
|
queryRenyuanByDepartID(params).then((res) => {
|
||||||
.then((res) => {
|
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
processData(res.result.records);
|
processData(res.result.records);
|
||||||
|
|
||||||
// 隐藏加载状态
|
// 隐藏加载状态
|
||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
}).catch((err) => {
|
||||||
.catch((err) => {
|
console.log(err)
|
||||||
console.log(err);
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '数据加载失败',
|
title: '数据加载失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error)
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '数据加载失败',
|
title: '数据加载失败',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
@ -178,17 +202,17 @@ const departChange = async (e, data) => {
|
|||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 数据处理
|
||||||
|
const processData = (data) => {
|
||||||
|
|
||||||
// 数据处理
|
|
||||||
const processData = (data) => {
|
|
||||||
// 添加年龄字段并过滤有效数据
|
// 添加年龄字段并过滤有效数据
|
||||||
const validData = data
|
const validData = data.map(item => ({
|
||||||
.map((item) => ({
|
|
||||||
...item,
|
...item,
|
||||||
nl: calculateAge(item.cssj)
|
nl: calculateAge(item.cssj)
|
||||||
}))
|
})).filter(item => item.nl >= 21 && item.nl <= 64);
|
||||||
.filter((item) => item.nl >= 21 && item.nl <= 64);
|
|
||||||
// 计算概览数据
|
// 计算概览数据
|
||||||
summary.total = validData.length;
|
summary.total = validData.length;
|
||||||
summary.avgAge = validData.reduce((sum, cur) => sum + cur.nl, 0) / summary.total || 0;
|
summary.avgAge = validData.reduce((sum, cur) => sum + cur.nl, 0) / summary.total || 0;
|
||||||
@ -198,25 +222,27 @@ const processData = (data) => {
|
|||||||
groupsData(validData);
|
groupsData(validData);
|
||||||
// 生成图表数据
|
// 生成图表数据
|
||||||
generateChartData(validData);
|
generateChartData(validData);
|
||||||
};
|
|
||||||
|
|
||||||
// 计算统计信息...
|
};
|
||||||
const subOrgStaffs = ref({}); // 按下级单位存储所有人员
|
|
||||||
const ageGroupStaffs = ref({}); // 按年龄段存储所有人员
|
|
||||||
|
|
||||||
const groupsData = (data) => {
|
// 计算统计信息...
|
||||||
|
const subOrgStaffs = ref({}); // 按下级单位存储所有人员
|
||||||
|
const ageGroupStaffs = ref({}); // 按年龄段存储所有人员
|
||||||
|
|
||||||
|
|
||||||
|
const groupsData = (data) => {
|
||||||
// 清空旧数据
|
// 清空旧数据
|
||||||
subOrgStaffs.value = {};
|
subOrgStaffs.value = {};
|
||||||
ageGroupStaffs.value = {};
|
ageGroupStaffs.value = {};
|
||||||
data.reduce((acc, cur) => {
|
data.reduce((acc, cur) => {
|
||||||
// console.log(cur)
|
// console.log(cur)
|
||||||
let subOrg = '';
|
let subOrg = "";
|
||||||
let ageRange = getAgeRange(cur.nl);
|
let ageRange = getAgeRange(cur.nl);
|
||||||
// console.log(cur.orgCode, cur.jcxdCode)
|
// console.log(cur.orgCode, cur.jcxdCode)
|
||||||
if (cur.orgCode <= 6) {
|
if (cur.orgCode <= 6) {
|
||||||
subOrg = cur.orgCode;
|
subOrg = cur.orgCode
|
||||||
} else {
|
} else {
|
||||||
subOrg = cur.jcxdCode;
|
subOrg = cur.jcxdCode
|
||||||
}
|
}
|
||||||
|
|
||||||
// 存储到subOrgStaffs
|
// 存储到subOrgStaffs
|
||||||
@ -230,38 +256,41 @@ const groupsData = (data) => {
|
|||||||
ageGroupStaffs.value[ageRange] = [];
|
ageGroupStaffs.value[ageRange] = [];
|
||||||
}
|
}
|
||||||
ageGroupStaffs.value[ageRange].push(cur);
|
ageGroupStaffs.value[ageRange].push(cur);
|
||||||
});
|
})
|
||||||
};
|
}
|
||||||
|
|
||||||
// 新增年龄范围计算方法
|
|
||||||
const getAgeRange = (age) => {
|
// 新增年龄范围计算方法
|
||||||
|
const getAgeRange = (age) => {
|
||||||
const ranges = ['21-30岁', '31-40岁', '41-50岁', '51-60岁', '61-64岁'];
|
const ranges = ['21-30岁', '31-40岁', '41-50岁', '51-60岁', '61-64岁'];
|
||||||
const index = Math.floor((age - 21) / 10);
|
const index = Math.floor((age - 21) / 10);
|
||||||
return ranges[index] || '其他';
|
return ranges[index] || '其他';
|
||||||
};
|
};
|
||||||
|
|
||||||
// 修改后的显示人员列表方法
|
// 修改后的显示人员列表方法
|
||||||
const showStaffList = (subOrg, ageRange) => {
|
const showStaffList = (subOrg, ageRange) => {
|
||||||
// 从结构化数据中直接获取
|
// 从结构化数据中直接获取
|
||||||
const targetStaffs = subOrgStaffs.value[subOrg].filter((staff) => getAgeRange(staff.nl) === ageRange);
|
const targetStaffs = subOrgStaffs.value[subOrg].filter(staff =>
|
||||||
|
getAgeRange(staff.nl) === ageRange
|
||||||
|
);
|
||||||
|
|
||||||
staffList.value = targetStaffs;
|
staffList.value = targetStaffs;
|
||||||
popupTitle.value = `${subOrg} ${ageRange}人员列表(共${targetStaffs.length}人)`;
|
popupTitle.value = `${subOrg} ${ageRange}人员列表(共${targetStaffs.length}人)`;
|
||||||
popup.value.open();
|
popup.value.open();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 新增获取指定单位人员的方法
|
// 新增获取指定单位人员的方法
|
||||||
const getSubOrgStaffs = (subOrgCode) => {
|
const getSubOrgStaffs = (subOrgCode) => {
|
||||||
return subOrgStaffs.value[subOrgCode] || [];
|
return subOrgStaffs.value[subOrgCode] || [];
|
||||||
};
|
};
|
||||||
|
|
||||||
// 新增获取指定年龄段人员的方法
|
// 新增获取指定年龄段人员的方法
|
||||||
const getAgeGroupStaffs = (ageRange) => {
|
const getAgeGroupStaffs = (ageRange) => {
|
||||||
return ageGroupStaffs.value[ageRange] || [];
|
return ageGroupStaffs.value[ageRange] || [];
|
||||||
};
|
};
|
||||||
|
|
||||||
// 生成图表数据(修改部分)
|
// 生成图表数据(修改部分)
|
||||||
const generateChartData = (data) => {
|
const generateChartData = (data) => {
|
||||||
// 按基层单位分组
|
// 按基层单位分组
|
||||||
const ageRanges = ['21-30岁', '31-40岁', '41-50岁', '51-60岁', '61-64岁'];
|
const ageRanges = ['21-30岁', '31-40岁', '41-50岁', '51-60岁', '61-64岁'];
|
||||||
const jcdwGroups = data.reduce((acc, cur) => {
|
const jcdwGroups = data.reduce((acc, cur) => {
|
||||||
@ -278,13 +307,14 @@ const generateChartData = (data) => {
|
|||||||
return acc;
|
return acc;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
|
|
||||||
// 生成分组柱状图配置
|
// 生成分组柱状图配置
|
||||||
const xData = Object.keys(jcdwGroups);
|
const xData = Object.keys(jcdwGroups);
|
||||||
|
|
||||||
const seriesData = ageRanges.map((range, index) => ({
|
const seriesData = ageRanges.map((range, index) => ({
|
||||||
name: range,
|
name: range,
|
||||||
type: 'bar',
|
type: 'bar',
|
||||||
data: xData.map((jcdw) => jcdwGroups[jcdw].ageGroups[index] || 0),
|
data: xData.map(jcdw => jcdwGroups[jcdw].ageGroups[index] || 0),
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: ['#5470C6', '#91CC75', '#FAC858', '#EE6666', '#73C0DE'][index]
|
color: ['#5470C6', '#91CC75', '#FAC858', '#EE6666', '#73C0DE'][index]
|
||||||
},
|
},
|
||||||
@ -292,14 +322,14 @@ const generateChartData = (data) => {
|
|||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
position: 'top'
|
position: 'top'
|
||||||
}
|
},
|
||||||
// 设置柱宽为 20 像素
|
// 设置柱宽为 20 像素
|
||||||
// barWidth: 20
|
// barWidth: 20
|
||||||
}));
|
}))
|
||||||
chartOption.value = {
|
chartOption.value = {
|
||||||
title: {
|
title: {
|
||||||
text: '人员年龄分组统计',
|
text: '人员年龄分组统计',
|
||||||
padding: [0, 0, 0, 30]
|
padding: [0, 0, 0, 30],
|
||||||
},
|
},
|
||||||
toolbox: {
|
toolbox: {
|
||||||
padding: [0, 30, 0, 0],
|
padding: [0, 30, 0, 0],
|
||||||
@ -347,7 +377,7 @@ const generateChartData = (data) => {
|
|||||||
color: '#7F84B5',
|
color: '#7F84B5',
|
||||||
fontWeight: 300,
|
fontWeight: 300,
|
||||||
interval: 0,
|
interval: 0,
|
||||||
rotate: 0
|
rotate: 0,
|
||||||
},
|
},
|
||||||
padding: [0, 10, 0, 10],
|
padding: [0, 10, 0, 10],
|
||||||
axisTick: {
|
axisTick: {
|
||||||
@ -357,8 +387,7 @@ const generateChartData = (data) => {
|
|||||||
show: false //不显示坐标轴线
|
show: false //不显示坐标轴线
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
yAxis: [
|
yAxis: [{
|
||||||
{
|
|
||||||
show: true,
|
show: true,
|
||||||
boundaryGap: false, //解决数据与线不对应问题
|
boundaryGap: false, //解决数据与线不对应问题
|
||||||
type: 'value',
|
type: 'value',
|
||||||
@ -382,36 +411,40 @@ const generateChartData = (data) => {
|
|||||||
axisLine: {
|
axisLine: {
|
||||||
show: false //不显示坐标轴线
|
show: false //不显示坐标轴线
|
||||||
}
|
}
|
||||||
}
|
}],
|
||||||
],
|
|
||||||
|
series: seriesData,
|
||||||
|
|
||||||
series: seriesData
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化图表
|
// 初始化图表
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (!chart.value) return;
|
if (!chart.value) return
|
||||||
const myChart = await chart.value.init(echarts);
|
const myChart = await chart.value.init(echarts)
|
||||||
myChart.setOption(chartOption.value);
|
myChart.setOption(chartOption.value)
|
||||||
myChart.on('click', (params) => {
|
myChart.on('click', (params) => {
|
||||||
console.log(params.seriesName);
|
console.log(params.seriesName)
|
||||||
tableData.value = getAgeGroupStaffs(params.seriesName);
|
tableData.value = getAgeGroupStaffs(params.seriesName)
|
||||||
});
|
|
||||||
}, 300);
|
})
|
||||||
|
}, 300)
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
getHeight();
|
getHeight();
|
||||||
// #endif
|
// #endif
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
getHeight();
|
getHeight();
|
||||||
// #endif
|
// #endif
|
||||||
});
|
})
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
|
|
||||||
const getHeight = () => {
|
const getHeight = () => {
|
||||||
// 获取屏幕高度
|
// 获取屏幕高度
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
const screenHeight = systemInfo.screenHeight;
|
const screenHeight = systemInfo.screenHeight;
|
||||||
@ -422,94 +455,95 @@ const getHeight = () => {
|
|||||||
.select('#top1')
|
.select('#top1')
|
||||||
.boundingClientRect((rect1) => {
|
.boundingClientRect((rect1) => {
|
||||||
// 计算上方组件高度总和
|
// 计算上方组件高度总和
|
||||||
const topComponentsHeight = rect1.height;
|
const topComponentsHeight = rect1.height
|
||||||
// 计算下方组件的高度
|
// 计算下方组件的高度
|
||||||
bottomHeight.value = screenHeight - topComponentsHeight - 415;
|
bottomHeight.value = screenHeight - topComponentsHeight - 415;
|
||||||
})
|
})
|
||||||
.exec();
|
.exec();
|
||||||
};
|
};
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
// 初始化图表
|
// 初始化图表
|
||||||
const initChart = () => {
|
const initChart = () => {
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
if (!chart.value) return;
|
if (!chart.value) return
|
||||||
const myChart = await chart.value.init(echarts);
|
const myChart = await chart.value.init(echarts)
|
||||||
myChart.setOption(chartOption.value);
|
myChart.setOption(chartOption.value)
|
||||||
}, 300);
|
}, 300)
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.container {
|
.container {
|
||||||
margin: 20, 20, 20, 20rpx;
|
margin: 20, 20, 20, 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-group {
|
.input-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 20rpx;
|
gap: 20rpx;
|
||||||
margin-bottom: 30rpx;
|
margin-bottom: 30rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
border: 1rpx solid #ddd;
|
border: 1rpx solid #ddd;
|
||||||
padding: 15rpx;
|
padding: 15rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.query-btn {
|
.query-btn {
|
||||||
background: #007aff;
|
background: #007AFF;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 0 40rpx;
|
padding: 0 40rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats-box {
|
.stats-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
margin: 30rpx 0;
|
margin: 30rpx 0;
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
background: #f8f8f8;
|
background: #f8f8f8;
|
||||||
border-radius: 12rpx;
|
border-radius: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-item {
|
.stat-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.value {
|
.value {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: #0000ff;
|
color: #0000ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chart-container {
|
.chart-container {
|
||||||
height: 400rpx;
|
height: 400rpx;
|
||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.titleStyle {
|
.titleStyle {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
color: #747474;
|
color: #747474;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
background: #f2f9fc;
|
background: #F2F9FC;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
border-left: 1px solid #919191;
|
border-left: 1px solid #919191;
|
||||||
border-bottom: 1px solid #919191;
|
border-bottom: 1px solid #919191;
|
||||||
}
|
;
|
||||||
|
}
|
||||||
|
|
||||||
/* 内容样式 */
|
/* 内容样式 */
|
||||||
.dataStyle {
|
.dataStyle {
|
||||||
max-font-size: 14px;
|
max-font-size: 14px;
|
||||||
/* 最大字体限制 */
|
/* 最大字体限制 */
|
||||||
min-font-size: 10px;
|
min-font-size: 10px;
|
||||||
@ -524,5 +558,6 @@ const initChart = () => {
|
|||||||
border-bottom: 1px solid #919191;
|
border-bottom: 1px solid #919191;
|
||||||
border-left: 1px solid #919191;
|
border-left: 1px solid #919191;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -1,517 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<view class="container" id="top1">
|
|
||||||
<uni-row style="margin-bottom: 10rpx; margin-left: 30rpx; margin-right: 30rpx">
|
|
||||||
<uni-col :span="24"><uni-title :title="'所选单位ID:' + orgCode" align="left" type="h4"></uni-title></uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<uni-row style="margin-bottom: 20rpx; margin-left: 30rpx; margin-right: 30rpx">
|
|
||||||
<uni-col :span="24">
|
|
||||||
<trq-depart-select v-model="orgCode" returnCodeOrID="orgCode" @change="departChange"></trq-depart-select>
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
<!-- 概览统计 -->
|
|
||||||
<view class="stats-box" v-if="summary.total">
|
|
||||||
<view class="stat-item">
|
|
||||||
<text class="label">总人数</text>
|
|
||||||
<text class="value">{{ summary.total }}</text>
|
|
||||||
</view>
|
|
||||||
<view class="stat-item">
|
|
||||||
<text class="label">平均年龄</text>
|
|
||||||
<text class="value">{{ summary.avgAge.toFixed(1) }}</text>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- ECharts图表 -->
|
|
||||||
<view class="chart-container">
|
|
||||||
<l-echart ref="chart" @finished="initChart" />
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 数据表格 -->
|
|
||||||
|
|
||||||
<uni-row style="margin-top: 10px; margin-left: 30rpx; margin-right: 30rpx" v-if="tableData.length > 0">
|
|
||||||
<uni-col :span="3">
|
|
||||||
<view class="titleStyle">序号</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="titleStyle">姓名</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="titleStyle">性别</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="titleStyle">年龄</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="6">
|
|
||||||
<view class="titleStyle">操作</view>
|
|
||||||
</uni-col>
|
|
||||||
</uni-row>
|
|
||||||
|
|
||||||
<scroll-view scroll-y :style="{ height: bottomHeight + 'px' }">
|
|
||||||
<uni-row style="margin-bottom: 10rpx; margin-left: 30rpx; margin-right: 30rpx">
|
|
||||||
<view v-for="(item, index) in tableData">
|
|
||||||
<uni-col :span="3">
|
|
||||||
<view class="dataStyle">
|
|
||||||
{{ index + 1 }}
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="dataStyle">
|
|
||||||
{{ item.xm }}
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="dataStyle">
|
|
||||||
{{ item.xb_dictText }}
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="5">
|
|
||||||
<view class="dataStyle">
|
|
||||||
{{ item.nl }}
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
|
||||||
<uni-col :span="6">
|
|
||||||
<view class="dataStyle">
|
|
||||||
<button size="mini" type="primary" @click="detail(item)">详情</button>
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
|
||||||
</view>
|
|
||||||
</uni-row>
|
|
||||||
</scroll-view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { ref, reactive, onMounted } from 'vue';
|
|
||||||
import * as echarts from 'echarts';
|
|
||||||
import { cxcRyDataTongji, queryRenyuanByDepartID } from '@/api/renyuan.js';
|
|
||||||
// 存储下方组件的高度
|
|
||||||
const bottomHeight = ref(0);
|
|
||||||
// 新增加载状态
|
|
||||||
const isLoading = ref(false);
|
|
||||||
const orgCode = ref('');
|
|
||||||
const rawData = ref([]);
|
|
||||||
const tableData = ref([]);
|
|
||||||
const summary = reactive({
|
|
||||||
total: 0,
|
|
||||||
avgAge: 0
|
|
||||||
});
|
|
||||||
const chart = ref(null);
|
|
||||||
const chartOption = ref({});
|
|
||||||
const drillPopup = ref(null);
|
|
||||||
const drillList = ref([]);
|
|
||||||
const drillTitle = ref('');
|
|
||||||
|
|
||||||
function detail(record) {
|
|
||||||
// console.log(record)
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/views/renliziyuan/renyuanxinxi/detail?data=' + encodeURIComponent(JSON.stringify(record))
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// 计算年龄initChart
|
|
||||||
const calculateAge = (birthDate) => {
|
|
||||||
const today = new Date();
|
|
||||||
const birth = new Date(birthDate);
|
|
||||||
let age = today.getFullYear() - birth.getFullYear();
|
|
||||||
const monthDiff = today.getMonth() - birth.getMonth();
|
|
||||||
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
|
|
||||||
age--;
|
|
||||||
}
|
|
||||||
return age;
|
|
||||||
};
|
|
||||||
// 加载数据
|
|
||||||
const departChange = async (e, data) => {
|
|
||||||
tableData.value = [];
|
|
||||||
console.log(e);
|
|
||||||
orgCode.value = e;
|
|
||||||
try {
|
|
||||||
// 显示加载状态
|
|
||||||
isLoading.value = true;
|
|
||||||
uni.showLoading({
|
|
||||||
title: '数据加载中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
|
|
||||||
let params = {
|
|
||||||
orgCode: orgCode.value
|
|
||||||
};
|
|
||||||
if (orgCode.value.length <= 9) {
|
|
||||||
params.orgCode = orgCode.value;
|
|
||||||
} else {
|
|
||||||
params.jcxd_code = orgCode.value;
|
|
||||||
}
|
|
||||||
cxcRyDataTongji(params)
|
|
||||||
.then((res) => {
|
|
||||||
console.log(res);
|
|
||||||
if (res.success) {
|
|
||||||
processData(res.result.records);
|
|
||||||
// 隐藏加载状态
|
|
||||||
isLoading.value = false;
|
|
||||||
uni.hideLoading();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.log(err);
|
|
||||||
uni.showToast({
|
|
||||||
title: '数据加载失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
uni.showToast({
|
|
||||||
title: '数据加载失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
// 隐藏加载状态
|
|
||||||
isLoading.value = false;
|
|
||||||
uni.hideLoading();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 数据处理
|
|
||||||
const processData = (data) => {
|
|
||||||
// 添加年龄字段并过滤有效数据
|
|
||||||
const validData = data
|
|
||||||
.map((item) => ({
|
|
||||||
...item,
|
|
||||||
nl: calculateAge(item.cssj)
|
|
||||||
}))
|
|
||||||
.filter((item) => item.nl >= 21 && item.nl <= 64);
|
|
||||||
// 计算概览数据
|
|
||||||
summary.total = validData.length;
|
|
||||||
summary.avgAge = validData.reduce((sum, cur) => sum + cur.nl, 0) / summary.total || 0;
|
|
||||||
// 生成表格数据
|
|
||||||
// tableData.value = validData;
|
|
||||||
|
|
||||||
groupsData(validData);
|
|
||||||
// 生成图表数据
|
|
||||||
generateChartData(validData);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 计算统计信息...
|
|
||||||
const subOrgStaffs = ref({}); // 按下级单位存储所有人员
|
|
||||||
const ageGroupStaffs = ref({}); // 按年龄段存储所有人员
|
|
||||||
|
|
||||||
const groupsData = (data) => {
|
|
||||||
// 清空旧数据
|
|
||||||
subOrgStaffs.value = {};
|
|
||||||
ageGroupStaffs.value = {};
|
|
||||||
data.reduce((acc, cur) => {
|
|
||||||
// console.log(cur)
|
|
||||||
let subOrg = '';
|
|
||||||
let ageRange = getAgeRange(cur.nl);
|
|
||||||
// console.log(cur.orgCode, cur.jcxdCode)
|
|
||||||
if (cur.orgCode <= 6) {
|
|
||||||
subOrg = cur.orgCode;
|
|
||||||
} else {
|
|
||||||
subOrg = cur.jcxdCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 存储到subOrgStaffs
|
|
||||||
if (!subOrgStaffs.value[subOrg]) {
|
|
||||||
subOrgStaffs.value[subOrg] = [];
|
|
||||||
}
|
|
||||||
subOrgStaffs.value[subOrg].push(cur);
|
|
||||||
|
|
||||||
// 存储到ageGroupStaffs
|
|
||||||
if (!ageGroupStaffs.value[ageRange]) {
|
|
||||||
ageGroupStaffs.value[ageRange] = [];
|
|
||||||
}
|
|
||||||
ageGroupStaffs.value[ageRange].push(cur);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增年龄范围计算方法
|
|
||||||
const getAgeRange = (age) => {
|
|
||||||
const ranges = ['21-30岁', '31-40岁', '41-50岁', '51-60岁', '61-64岁'];
|
|
||||||
const index = Math.floor((age - 21) / 10);
|
|
||||||
return ranges[index] || '其他';
|
|
||||||
};
|
|
||||||
|
|
||||||
// 修改后的显示人员列表方法
|
|
||||||
const showStaffList = (subOrg, ageRange) => {
|
|
||||||
// 从结构化数据中直接获取
|
|
||||||
const targetStaffs = subOrgStaffs.value[subOrg].filter((staff) => getAgeRange(staff.nl) === ageRange);
|
|
||||||
|
|
||||||
staffList.value = targetStaffs;
|
|
||||||
popupTitle.value = `${subOrg} ${ageRange}人员列表(共${targetStaffs.length}人)`;
|
|
||||||
popup.value.open();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增获取指定单位人员的方法
|
|
||||||
const getSubOrgStaffs = (subOrgCode) => {
|
|
||||||
return subOrgStaffs.value[subOrgCode] || [];
|
|
||||||
};
|
|
||||||
|
|
||||||
// 新增获取指定年龄段人员的方法
|
|
||||||
const getAgeGroupStaffs = (ageRange) => {
|
|
||||||
return ageGroupStaffs.value[ageRange] || [];
|
|
||||||
};
|
|
||||||
|
|
||||||
// 生成图表数据(修改部分)
|
|
||||||
const generateChartData = (data) => {
|
|
||||||
// 按基层单位分组
|
|
||||||
const ageRanges = ['21-30岁', '31-40岁', '41-50岁', '51-60岁', '61-64岁'];
|
|
||||||
const jcdwGroups = data.reduce((acc, cur) => {
|
|
||||||
if (!acc[cur.jcdw]) {
|
|
||||||
acc[cur.jcdw] = {
|
|
||||||
ageGroups: [0, 0, 0, 0, 0] // 21-30,31-40,41-50,51-60,61-64
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const ageGroup = Math.floor((cur.nl - 21) / 10);
|
|
||||||
// console.log(ageGroup, cur.jcdw)
|
|
||||||
if (ageGroup >= 0 && ageGroup <= 4) {
|
|
||||||
acc[cur.jcdw].ageGroups[ageGroup]++;
|
|
||||||
}
|
|
||||||
return acc;
|
|
||||||
}, {});
|
|
||||||
|
|
||||||
// 生成分组柱状图配置
|
|
||||||
const xData = Object.keys(jcdwGroups);
|
|
||||||
|
|
||||||
const seriesData = ageRanges.map((range, index) => ({
|
|
||||||
name: range,
|
|
||||||
type: 'bar',
|
|
||||||
data: xData.map((jcdw) => jcdwGroups[jcdw].ageGroups[index] || 0),
|
|
||||||
itemStyle: {
|
|
||||||
color: ['#5470C6', '#91CC75', '#FAC858', '#EE6666', '#73C0DE'][index]
|
|
||||||
},
|
|
||||||
// 显示数值标签
|
|
||||||
label: {
|
|
||||||
show: true,
|
|
||||||
position: 'top'
|
|
||||||
}
|
|
||||||
// 设置柱宽为 20 像素
|
|
||||||
// barWidth: 20
|
|
||||||
}));
|
|
||||||
chartOption.value = {
|
|
||||||
title: {
|
|
||||||
text: '人员年龄分组统计',
|
|
||||||
padding: [0, 0, 0, 30]
|
|
||||||
},
|
|
||||||
toolbox: {
|
|
||||||
padding: [0, 30, 0, 0],
|
|
||||||
show: true,
|
|
||||||
feature: {
|
|
||||||
//工具配置项
|
|
||||||
|
|
||||||
restore: {
|
|
||||||
show: true //是否显示该工具
|
|
||||||
},
|
|
||||||
saveAsImage: {
|
|
||||||
show: true //是否显示该工具
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// tooltip: {
|
|
||||||
// trigger: 'axis',
|
|
||||||
// axisPointer: {
|
|
||||||
// type: 'shadow',
|
|
||||||
// label: {
|
|
||||||
// show: false
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
grid: {
|
|
||||||
top: '15%',
|
|
||||||
left: '4%',
|
|
||||||
right: '4%',
|
|
||||||
bottom: '10%',
|
|
||||||
containLabel: true
|
|
||||||
},
|
|
||||||
legend: {
|
|
||||||
data: ageRanges,
|
|
||||||
itemGap: 5,
|
|
||||||
padding: [0, 15, 0, 15],
|
|
||||||
y: 'bottom',
|
|
||||||
itemHeight: 8, //高
|
|
||||||
itemWidth: 8, //宽
|
|
||||||
type: 'scroll'
|
|
||||||
},
|
|
||||||
xAxis: {
|
|
||||||
type: 'category',
|
|
||||||
data: xData,
|
|
||||||
axisLabel: {
|
|
||||||
color: '#7F84B5',
|
|
||||||
fontWeight: 300,
|
|
||||||
interval: 0,
|
|
||||||
rotate: 0
|
|
||||||
},
|
|
||||||
padding: [0, 10, 0, 10],
|
|
||||||
axisTick: {
|
|
||||||
show: false //刻度线
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: false //不显示坐标轴线
|
|
||||||
}
|
|
||||||
},
|
|
||||||
yAxis: [
|
|
||||||
{
|
|
||||||
show: true,
|
|
||||||
boundaryGap: false, //解决数据与线不对应问题
|
|
||||||
type: 'value',
|
|
||||||
// name: 'Budget (million USD)',
|
|
||||||
// data: this.yList,
|
|
||||||
minInterval: 1,
|
|
||||||
axisLabel: {
|
|
||||||
interval: 0
|
|
||||||
},
|
|
||||||
splitLine: {
|
|
||||||
show: true,
|
|
||||||
lineStyle: {
|
|
||||||
//背景网格线
|
|
||||||
type: 'dashed'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
axisTick: {
|
|
||||||
show: true //刻度线
|
|
||||||
},
|
|
||||||
axisLine: {
|
|
||||||
show: false //不显示坐标轴线
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
|
|
||||||
series: seriesData
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化图表
|
|
||||||
setTimeout(async () => {
|
|
||||||
if (!chart.value) return;
|
|
||||||
const myChart = await chart.value.init(echarts);
|
|
||||||
myChart.setOption(chartOption.value);
|
|
||||||
myChart.on('click', (params) => {
|
|
||||||
console.log(params.seriesName);
|
|
||||||
tableData.value = getAgeGroupStaffs(params.seriesName);
|
|
||||||
});
|
|
||||||
}, 300);
|
|
||||||
|
|
||||||
// #ifdef APP
|
|
||||||
getHeight();
|
|
||||||
// #endif
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// #ifdef APP
|
|
||||||
getHeight();
|
|
||||||
// #endif
|
|
||||||
});
|
|
||||||
// #ifdef APP
|
|
||||||
|
|
||||||
const getHeight = () => {
|
|
||||||
// 获取屏幕高度
|
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
|
||||||
const screenHeight = systemInfo.screenHeight;
|
|
||||||
// 创建选择器查询对象
|
|
||||||
const query = uni.createSelectorQuery();
|
|
||||||
// 获取上方组件的高度
|
|
||||||
query
|
|
||||||
.select('#top1')
|
|
||||||
.boundingClientRect((rect1) => {
|
|
||||||
// 计算上方组件高度总和
|
|
||||||
const topComponentsHeight = rect1.height;
|
|
||||||
// 计算下方组件的高度
|
|
||||||
bottomHeight.value = screenHeight - topComponentsHeight - 415;
|
|
||||||
})
|
|
||||||
.exec();
|
|
||||||
};
|
|
||||||
|
|
||||||
// #endif
|
|
||||||
// 初始化图表
|
|
||||||
const initChart = () => {
|
|
||||||
setTimeout(async () => {
|
|
||||||
if (!chart.value) return;
|
|
||||||
const myChart = await chart.value.init(echarts);
|
|
||||||
myChart.setOption(chartOption.value);
|
|
||||||
}, 300);
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.container {
|
|
||||||
margin: 20, 20, 20, 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-group {
|
|
||||||
display: flex;
|
|
||||||
gap: 20rpx;
|
|
||||||
margin-bottom: 30rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input {
|
|
||||||
flex: 1;
|
|
||||||
border: 1rpx solid #ddd;
|
|
||||||
padding: 15rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.query-btn {
|
|
||||||
background: #007aff;
|
|
||||||
color: white;
|
|
||||||
padding: 0 40rpx;
|
|
||||||
border-radius: 8rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stats-box {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
margin: 30rpx 0;
|
|
||||||
padding: 20rpx;
|
|
||||||
background: #f8f8f8;
|
|
||||||
border-radius: 12rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stat-item {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.value {
|
|
||||||
font-size: 36rpx;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #0000ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chart-container {
|
|
||||||
height: 400rpx;
|
|
||||||
margin-top: 20rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.titleStyle {
|
|
||||||
font-size: 12px;
|
|
||||||
color: #747474;
|
|
||||||
line-height: 30px;
|
|
||||||
height: 30px;
|
|
||||||
background: #f2f9fc;
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
border-left: 1px solid #919191;
|
|
||||||
border-bottom: 1px solid #919191;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 内容样式 */
|
|
||||||
.dataStyle {
|
|
||||||
max-font-size: 14px;
|
|
||||||
/* 最大字体限制 */
|
|
||||||
min-font-size: 10px;
|
|
||||||
/* 最小字体限制 */
|
|
||||||
font-size: 12px;
|
|
||||||
color: #00007f;
|
|
||||||
line-height: 30px;
|
|
||||||
height: 30px;
|
|
||||||
font-weight: 500;
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
border-bottom: 1px solid #919191;
|
|
||||||
border-left: 1px solid #919191;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -37,12 +37,6 @@ export const useUpdateApp = defineStore('updateApp', () => {
|
|||||||
} = res
|
} = res
|
||||||
result.apkUrl = baseUrl + result.apkUrl;
|
result.apkUrl = baseUrl + result.apkUrl;
|
||||||
result.wgtUrl = baseUrl + result.wgtUrl
|
result.wgtUrl = baseUrl + result.wgtUrl
|
||||||
// res = {
|
|
||||||
// "update": "wgt",
|
|
||||||
// "wgtUrl": "D:\\opt\\AppUpdate\\wgt\\2.2.34.wgt",
|
|
||||||
// "apkUrl": null,
|
|
||||||
// "versionCode": "1.0.0"
|
|
||||||
// }
|
|
||||||
// updateOptions.force = res.is_force === 1
|
// updateOptions.force = res.is_force === 1
|
||||||
// updateOptions.content = res.update_content
|
// updateOptions.content = res.update_content
|
||||||
updateOptions.wgtUrl = result.wgtUrl
|
updateOptions.wgtUrl = result.wgtUrl
|
||||||
|
@ -7,7 +7,7 @@ import {isDef} from '../isDef'
|
|||||||
* @returns 添加了单位的值,如果值为 null 则返回 null
|
* @returns 添加了单位的值,如果值为 null 则返回 null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export function addUnit(value?: string | number): string | null {
|
export function addUnit(value?: string | number): string | null {
|
||||||
if (!isDef(value)) {
|
if (!isDef(value)) {
|
||||||
return null;
|
return null;
|
||||||
@ -19,7 +19,7 @@ export function addUnit(value?: string | number): string | null {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
function addUnit(value: string): string
|
function addUnit(value: string): string
|
||||||
function addUnit(value: number): string
|
function addUnit(value: number): string
|
||||||
function addUnit(value: any|null): string|null {
|
function addUnit(value: any|null): string|null {
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
import {cubicBezier} from './bezier';
|
import {cubicBezier} from './bezier';
|
||||||
export let ease = cubicBezier(0.25, 0.1, 0.25, 1);
|
export let ease = cubicBezier(0.25, 0.1, 0.25, 1);
|
||||||
|
export let linear = cubicBezier(0,0,1,1);
|
@ -1,10 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.uts'
|
export * from './uvue.uts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { ComponentPublicInstance } from 'vue'
|
import type { ComponentPublicInstance } from 'vue'
|
||||||
import { ease } from './ease';
|
import { ease, linear } from './ease';
|
||||||
import { Timeline, Animation } from './';
|
import { Timeline, Animation } from './';
|
||||||
export type UseTransitionOptions = {
|
export type UseTransitionOptions = {
|
||||||
duration ?: number
|
duration ?: number
|
||||||
immediate ?: boolean
|
immediate ?: boolean
|
||||||
context ?: ComponentPublicInstance
|
context ?: ComponentPublicInstance
|
||||||
}
|
}
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
import { ref, watch, Ref } from '@/uni_modules/lime-shared/vue'
|
import { ref, watch, type Ref } from '@/uni_modules/lime-shared/vue'
|
||||||
|
|
||||||
export function useTransition(percent : Ref<number>|(() => number), options : UseTransitionOptions) : Ref<number> {
|
export function useTransition(percent : Ref<number>|(() => number), options : UseTransitionOptions) : Ref<number> {
|
||||||
const current = ref(0)
|
const current = ref(0)
|
||||||
@ -47,7 +47,7 @@ export function useTransition(percent : Ref<number>|(() => number), options : Us
|
|||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
type UseTransitionReturnType = Ref<number>
|
type UseTransitionReturnType = Ref<number>
|
||||||
export function useTransition(source : any, options : UseTransitionOptions) : UseTransitionReturnType {
|
export function useTransition(source : any, options : UseTransitionOptions) : UseTransitionReturnType {
|
||||||
const outputRef : Ref<number> = ref(0)
|
const outputRef : Ref<number> = ref(0)
|
||||||
@ -69,7 +69,7 @@ export function useTransition(source : any, options : UseTransitionOptions) : Us
|
|||||||
0,
|
0,
|
||||||
ease,
|
ease,
|
||||||
nowValue => {
|
nowValue => {
|
||||||
outputRef.value = nowValue //nowValue < 0.0001 ? 0 : Math.abs(v - nowValue) < 0.00001 ? v : nowValue;
|
outputRef.value = nowValue
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
if(outputRef.value == v){
|
if(outputRef.value == v){
|
||||||
timer = setTimeout(()=>{
|
timer = setTimeout(()=>{
|
||||||
@ -78,14 +78,17 @@ export function useTransition(source : any, options : UseTransitionOptions) : Us
|
|||||||
}, duration)
|
}, duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
), null
|
),
|
||||||
|
null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context != null && typeof source == 'string') {
|
if (context != null && typeof source == 'string') {
|
||||||
context.$watch(source, watchFunc, { immediate } as WatchOptions)
|
context.$watch(source, watchFunc, { immediate } as WatchOptions)
|
||||||
} else {
|
} else if(typeof source == 'function'){
|
||||||
watch(source, watchFunc, { immediate } as WatchOptions)
|
watch(source, watchFunc, { immediate })
|
||||||
|
} else if(source instanceof Ref<number>){
|
||||||
|
watch(source as Ref<number>, watchFunc, { immediate })
|
||||||
}
|
}
|
||||||
|
|
||||||
const stop = ()=>{
|
const stop = ()=>{
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { raf, cancelRaf} from '../raf'
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
export class Timeline {
|
export class Timeline {
|
||||||
state : string
|
state : string
|
||||||
@ -13,7 +14,7 @@ export class Timeline {
|
|||||||
this.state = 'Initiated';
|
this.state = 'Initiated';
|
||||||
}
|
}
|
||||||
start() {
|
start() {
|
||||||
if (!(this.state === 'Initiated')) return;
|
if (!(this.state == 'Initiated')) return;
|
||||||
this.state = 'Started';
|
this.state = 'Started';
|
||||||
|
|
||||||
let startTime = Date.now();
|
let startTime = Date.now();
|
||||||
@ -43,20 +44,26 @@ export class Timeline {
|
|||||||
if (animation == null) return
|
if (animation == null) return
|
||||||
this.animations.delete(animation);
|
this.animations.delete(animation);
|
||||||
}
|
}
|
||||||
clearTimeout(this.tickHandler);
|
// cancelAnimationFrame(this.tickHandler);
|
||||||
if (this.state != 'Started') return
|
if (this.state != 'Started') return
|
||||||
this.tickHandler = setTimeout(() => {
|
|
||||||
|
this.tickHandler = raf(()=>{
|
||||||
this.tick!()
|
this.tick!()
|
||||||
}, 1000 / 60)
|
})
|
||||||
// this.tickHandlers.push(this.tickHandler)
|
|
||||||
|
this.tickHandlers.push(this.tickHandler)
|
||||||
}
|
}
|
||||||
|
if(this.tick != null) {
|
||||||
this.tick!()
|
this.tick!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
pause() {
|
pause() {
|
||||||
if (!(this.state === 'Started')) return;
|
if (!(this.state === 'Started')) return;
|
||||||
this.state = 'Paused';
|
this.state = 'Paused';
|
||||||
this.pauseStart = Date.now();
|
this.pauseStart = Date.now();
|
||||||
clearTimeout(this.tickHandler);
|
cancelRaf(this.tickHandler);
|
||||||
|
// cancelRaf(this.tickHandler);
|
||||||
}
|
}
|
||||||
resume() {
|
resume() {
|
||||||
if (!(this.state === 'Paused')) return;
|
if (!(this.state === 'Paused')) return;
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef UNI-APP-X
|
// #ifdef UNI-APP-X && APP
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
|
||||||
export * from './uvue.uts'
|
export * from './uvue.uts'
|
||||||
// #endif
|
// #endif
|
||||||
// #endif
|
|
@ -1,9 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.uts'
|
export * from './uvue.uts'
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
|
|
||||||
// #ifdef MP-ALIPAY
|
// #ifdef MP-ALIPAY
|
||||||
interface My {
|
interface My {
|
||||||
@ -57,11 +57,11 @@ export function canIUseCanvas2d(): boolean {
|
|||||||
// #ifdef MP-TOUTIAO
|
// #ifdef MP-TOUTIAO
|
||||||
return gte('1.78.0');
|
return gte('1.78.0');
|
||||||
// #endif
|
// #endif
|
||||||
|
// #ifdef UNI-APP-X && WEB || UNI-APP-X && APP
|
||||||
|
return true;
|
||||||
|
// #endif
|
||||||
// #ifndef MP-WEIXIN || MP-ALIPAY || MP-TOUTIAO
|
// #ifndef MP-WEIXIN || MP-ALIPAY || MP-TOUTIAO
|
||||||
return false
|
return false
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID || APP-NVUE || APP-VUE
|
|
||||||
return false;
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,26 @@
|
|||||||
|
|
||||||
|
## 0.2.7(2025-01-17)
|
||||||
|
- fix: 针对canvas 平台判断优化
|
||||||
|
## 0.2.6(2025-01-09)
|
||||||
|
- feat: 增加`areaData`中国省市区数据
|
||||||
|
## 0.2.5(2025-01-07)
|
||||||
|
- fix: animation在app上类型问题
|
||||||
|
## 0.2.4(2025-01-04)
|
||||||
|
- feat: getRect类型问题
|
||||||
|
## 0.2.3(2025-01-01)
|
||||||
|
- chore: unitConvert使用uni.rpx2px
|
||||||
|
## 0.2.2(2024-12-11)
|
||||||
|
- chore: 动画使用`requestAnimationFrame`
|
||||||
|
## 0.2.1(2024-11-20)
|
||||||
|
- feat: 增加`characterLimit`
|
||||||
|
## 0.2.0(2024-11-14)
|
||||||
|
- fix: vue2的类型问题
|
||||||
|
## 0.1.9(2024-11-14)
|
||||||
|
- feat: 增加`shuffle`
|
||||||
|
## 0.1.8(2024-10-08)
|
||||||
|
- fix: vue2 条件编译 // #ifdef APP-IOS || APP-ANDROID 会生效
|
||||||
|
## 0.1.7(2024-09-23)
|
||||||
|
- fix: raf 类型跟随版本变更
|
||||||
## 0.1.6(2024-07-24)
|
## 0.1.6(2024-07-24)
|
||||||
- fix: vue2 app ts需要明确的后缀,所有补全
|
- fix: vue2 app ts需要明确的后缀,所有补全
|
||||||
- chore: 减少依赖
|
- chore: 减少依赖
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.ts'
|
export * from './uvue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
@ -15,6 +15,9 @@
|
|||||||
import { debounce } from '@/uni_modules/lime-shared/debounce'
|
import { debounce } from '@/uni_modules/lime-shared/debounce'
|
||||||
import { fillZero } from '@/uni_modules/lime-shared/fillZero'
|
import { fillZero } from '@/uni_modules/lime-shared/fillZero'
|
||||||
import { floatAdd } from '@/uni_modules/lime-shared/floatAdd'
|
import { floatAdd } from '@/uni_modules/lime-shared/floatAdd'
|
||||||
|
import { floatMul } from '@/uni_modules/lime-shared/floatMul'
|
||||||
|
import { floatDiv } from '@/uni_modules/lime-shared/floatDiv'
|
||||||
|
import { floatSub } from '@/uni_modules/lime-shared/floatSub'
|
||||||
import { getClassStr } from '@/uni_modules/lime-shared/getClassStr'
|
import { getClassStr } from '@/uni_modules/lime-shared/getClassStr'
|
||||||
import { getCurrentPage } from '@/uni_modules/lime-shared/getCurrentPage'
|
import { getCurrentPage } from '@/uni_modules/lime-shared/getCurrentPage'
|
||||||
import { getStyleStr } from '@/uni_modules/lime-shared/getStyleStr'
|
import { getStyleStr } from '@/uni_modules/lime-shared/getStyleStr'
|
||||||
@ -40,91 +43,102 @@
|
|||||||
import { toNumber } from '@/uni_modules/lime-shared/toNumber'
|
import { toNumber } from '@/uni_modules/lime-shared/toNumber'
|
||||||
import { unitConvert } from '@/uni_modules/lime-shared/unitConvert'
|
import { unitConvert } from '@/uni_modules/lime-shared/unitConvert'
|
||||||
import { getCurrentInstance } from '@/uni_modules/lime-shared/vue'
|
import { getCurrentInstance } from '@/uni_modules/lime-shared/vue'
|
||||||
|
import { capitalizedAmount } from '@/uni_modules/lime-shared/capitalizedAmount'
|
||||||
|
|
||||||
// #ifdef VUE2
|
// #ifdef VUE2
|
||||||
type UTSJSONObject = any
|
type UTSJSONObject = any
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
const context = getCurrentInstance()
|
const context = getCurrentInstance()
|
||||||
getRect('#shared', context!).then(res =>{
|
// getRect('#shared', context!).then(res =>{
|
||||||
console.log('res', res.bottom)
|
// console.log('res', res.bottom)
|
||||||
})
|
// })
|
||||||
getAllRect('#shared', context).then(res =>{
|
// getAllRect('#shared', context).then(res =>{
|
||||||
console.log('res', res)
|
// console.log('res', res)
|
||||||
})
|
// })
|
||||||
|
|
||||||
|
|
||||||
console.log('camelCase::', camelCase("hello world"));
|
// console.log('camelCase::', camelCase("hello world"));
|
||||||
console.log('camelCase::', camelCase("my_name_is_john", true));
|
// console.log('camelCase::', camelCase("my_name_is_john", true));
|
||||||
console.log('canIUseCanvas2d::', canIUseCanvas2d());
|
// console.log('canIUseCanvas2d::', canIUseCanvas2d());
|
||||||
console.log('clamp::', clamp(5 ,0, 10));
|
// console.log('clamp::', clamp(5 ,0, 10));
|
||||||
console.log('cloneDeep::', cloneDeep<UTSJSONObject>({a:5}));
|
// console.log('cloneDeep::', cloneDeep<UTSJSONObject>({a:5}));
|
||||||
console.log('closest::', closest([1, 3, 5, 7, 9], 6));
|
// console.log('closest::', closest([1, 3, 5, 7, 9], 6));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const saveData = (data: any) => {
|
// const saveData = (data: any) => {
|
||||||
// 模拟保存数据的操作
|
// // 模拟保存数据的操作
|
||||||
console.log(`Saving data: ${data}`);
|
// console.log(`Saving data: ${data}`);
|
||||||
}
|
// }
|
||||||
|
|
||||||
const debouncedSaveData = debounce(saveData, 500);
|
// const debouncedSaveData = debounce(saveData, 500);
|
||||||
debouncedSaveData('Data 1');
|
// debouncedSaveData('Data 1');
|
||||||
debouncedSaveData('Data 2');
|
// debouncedSaveData('Data 2');
|
||||||
|
|
||||||
console.log('fillZero', fillZero(1))
|
// console.log('fillZero', fillZero(1))
|
||||||
console.log('floatAdd', floatAdd(0.1, 0.2))
|
// console.log('floatAdd', floatAdd(0.1, 0.2), floatAdd(1.05, 0.05), floatAdd(0.1, 0.7), floatAdd(0.0001, 0.0002), floatAdd(123.456 , 789.012))
|
||||||
console.log('getClassStr', getClassStr({hover: true}))
|
// console.log('floatMul', floatMul(0.1, 0.02), floatMul(1.0255, 100))
|
||||||
console.log('getStyleStr', getStyleStr({ color: 'red', fontSize: '16px', backgroundColor: '', border: null }))
|
// console.log('floatDiv', floatDiv(10.44, 100), floatDiv(1.0255, 100), floatDiv(5.419909340994699, 0.2))
|
||||||
console.log('hasOwn', hasOwn({a: true}, 'key'))
|
// console.log('floatSub', floatSub(0.4, 0.1), floatSub(1.0255, 100))
|
||||||
console.log('isBase64::', isBase64("SGVsbG8sIFdvcmxkIQ=="));
|
const now = () : number => System.nanoTime() / 1_000_000.0
|
||||||
console.log('isBrowser::', isBrowser);
|
console.log('capitalizedAmount', capitalizedAmount(0.4))
|
||||||
console.log('isDef::', isDef('6'));
|
console.log('capitalizedAmount', capitalizedAmount(100))
|
||||||
console.log('isEmpty::', isEmpty({a: true}));
|
console.log('capitalizedAmount', capitalizedAmount(100000000))
|
||||||
|
console.log('capitalizedAmount', capitalizedAmount('2023.04'))
|
||||||
|
console.log('capitalizedAmount', capitalizedAmount(-1024))
|
||||||
|
console.log('now', now(), Date.now())
|
||||||
|
// console.log('getClassStr', getClassStr({hover: true}))
|
||||||
|
// console.log('getStyleStr', getStyleStr({ color: 'red', fontSize: '16px', backgroundColor: '', border: null }))
|
||||||
|
// console.log('hasOwn', hasOwn({a: true}, 'key'))
|
||||||
|
// console.log('isBase64::', isBase64("SGVsbG8sIFdvcmxkIQ=="));
|
||||||
|
// console.log('isBrowser::', isBrowser);
|
||||||
|
// console.log('isDef::', isDef('6'));
|
||||||
|
// console.log('isEmpty::', isEmpty({a: true}));
|
||||||
|
|
||||||
const b = () =>{}
|
// const b = () =>{}
|
||||||
console.log('isFunction::', isFunction(b));
|
// console.log('isFunction::', isFunction(b));
|
||||||
console.log('isNumber::', isNumber('6'));
|
// console.log('isNumber::', isNumber('6'));
|
||||||
console.log('isNumeric::', isNumeric('6'));
|
// console.log('isNumeric::', isNumeric('6'));
|
||||||
console.log('isObject::', isObject({}));
|
// console.log('isObject::', isObject({}));
|
||||||
|
|
||||||
const promise = ():Promise<boolean> => {
|
// const promise = ():Promise<boolean> => {
|
||||||
return new Promise((resolve) => {
|
// return new Promise((resolve) => {
|
||||||
resolve(true)
|
// resolve(true)
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
const a = promise()
|
// const a = promise()
|
||||||
console.log('isPromise::', isPromise(a));
|
// console.log('isPromise::', isPromise(a));
|
||||||
console.log('isString::', isString('null'));
|
// console.log('isString::', isString('null'));
|
||||||
console.log('kebabCase::', kebabCase('my love'));
|
// console.log('kebabCase::', kebabCase('my love'));
|
||||||
console.log('raf::', raf(()=>{
|
// console.log('raf::', raf(()=>{
|
||||||
console.log('raf:::1')
|
// console.log('raf:::1')
|
||||||
}));
|
// }));
|
||||||
console.log('doubleRaf::', doubleRaf(()=>{
|
// console.log('doubleRaf::', doubleRaf(()=>{
|
||||||
console.log('doubleRaf:::1')
|
// console.log('doubleRaf:::1')
|
||||||
}));
|
// }));
|
||||||
console.log('random', random(0, 10))
|
// console.log('random', random(0, 10))
|
||||||
console.log('random', random(0, 1, 2))
|
// console.log('random', random(0, 1, 2))
|
||||||
console.log('range', range(0, 10, 2))
|
// console.log('range', range(0, 10, 2))
|
||||||
console.log('sleep', sleep(300).then(res => {
|
// console.log('sleep', sleep(300).then(res => {
|
||||||
console.log('log')
|
// console.log('log')
|
||||||
}))
|
// }))
|
||||||
|
|
||||||
const handleScroll = (a: string) => {
|
// const handleScroll = (a: string) => {
|
||||||
console.log("Scroll event handled!", a);
|
// console.log("Scroll event handled!", a);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// // 使用节流函数对 handleScroll 进行节流,间隔时间为 500 毫秒
|
// // // 使用节流函数对 handleScroll 进行节流,间隔时间为 500 毫秒
|
||||||
const throttledScroll = throttle(handleScroll, 500);
|
// const throttledScroll = throttle(handleScroll, 500);
|
||||||
throttledScroll('5');
|
// throttledScroll('5');
|
||||||
const page = getCurrentPage()
|
// const page = getCurrentPage()
|
||||||
console.log('getCurrentPage::', page)
|
// console.log('getCurrentPage::', page)
|
||||||
|
|
||||||
console.log('toArray', toArray<number>(5))
|
// console.log('toArray', toArray<number>(5))
|
||||||
console.log('toBoolean', toBoolean(5))
|
// console.log('toBoolean', toBoolean(5))
|
||||||
console.log('toNumber', toNumber('5'))
|
// console.log('toNumber', toNumber('5'))
|
||||||
console.log('unitConvert', unitConvert('5'))
|
// console.log('unitConvert', unitConvert('5'))
|
||||||
|
|
||||||
// uni.getImageInfo({
|
// uni.getImageInfo({
|
||||||
// src: '/static/logo.png',
|
// src: '/static/logo.png',
|
||||||
@ -132,6 +146,9 @@
|
|||||||
// console.log('res', res)
|
// console.log('res', res)
|
||||||
// }
|
// }
|
||||||
// })
|
// })
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
import {isBrowser} from '../isBrowser'
|
import {isBrowser} from '../isBrowser'
|
||||||
class Image {
|
class Image {
|
||||||
currentSrc: string | null = null
|
currentSrc: string | null = null
|
||||||
@ -63,8 +63,9 @@ export function createImage(canvas?: any): HTMLImageElement | UniImage {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export function createImage(){
|
export function createImage():Image{
|
||||||
console.error('当前环境不支持')
|
// console.error('当前环境不支持')
|
||||||
|
return new Image()
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.ts'
|
export * from './uvue.ts'
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
@ -1,9 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.ts'
|
export * from './uvue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
import {isNumber} from '../isNumber'
|
import { isNumber } from '../isNumber'
|
||||||
/**
|
/**
|
||||||
* 返回两个浮点数相加的结果
|
* 返回两个浮点数相加的结果
|
||||||
* @param num1 第一个浮点数
|
* @param num1 第一个浮点数
|
||||||
* @param num2 第二个浮点数
|
* @param num2 第二个浮点数
|
||||||
* @returns 两个浮点数的相加结果
|
* @returns 两个浮点数的相加结果
|
||||||
*/
|
*/
|
||||||
export function floatAdd(num1: number, num2: number): number {
|
export function floatAdd(num1 : number, num2 : number) : number {
|
||||||
// 检查 num1 和 num2 是否为数字类型
|
// 检查 num1 和 num2 是否为数字类型
|
||||||
if (!(isNumber(num1) || isNumber(num2))) {
|
if (!(isNumber(num1) || isNumber(num2))) {
|
||||||
console.warn('Please pass in the number type');
|
console.warn('Please pass in the number type');
|
||||||
return NaN;
|
return NaN;
|
||||||
}
|
}
|
||||||
|
|
||||||
let r1: number, r2: number, m: number;
|
let r1 : number, r2 : number, m : number;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 获取 num1 小数点后的位数
|
// 获取 num1 小数点后的位数
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
import { isNumber } from '../isNumber'
|
import { isNumber } from '../isNumber'
|
||||||
import { isString } from '../isString'
|
import { isString } from '../isString'
|
||||||
import { isDef } from '../isDef'
|
import { isDef } from '../isDef'
|
||||||
@ -13,7 +13,7 @@ import { isDef } from '../isDef'
|
|||||||
*/
|
*/
|
||||||
export function getClassStr<T>(obj : T) : string {
|
export function getClassStr<T>(obj : T) : string {
|
||||||
let classNames : string[] = [];
|
let classNames : string[] = [];
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
if (obj instanceof UTSJSONObject) {
|
if (obj instanceof UTSJSONObject) {
|
||||||
(obj as UTSJSONObject).toMap().forEach((value, key) => {
|
(obj as UTSJSONObject).toMap().forEach((value, key) => {
|
||||||
if (isDef(value)) {
|
if (isDef(value)) {
|
||||||
@ -30,7 +30,7 @@ export function getClassStr<T>(obj : T) : string {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
// 遍历对象的属性
|
// 遍历对象的属性
|
||||||
for (let key in obj) {
|
for (let key in obj) {
|
||||||
// 检查属性确实属于对象自身且其值为true
|
// 检查属性确实属于对象自身且其值为true
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.uts'
|
export * from './uvue.uts'
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -16,7 +16,7 @@ export const getLocalFilePath = (path : string) => {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-ANDROID || APP-IOS
|
// #ifdef UNI-APP-X && APP
|
||||||
export { getResourcePath as getLocalFilePath } from '@/uni_modules/lime-file-utils'
|
export { getResourcePath as getLocalFilePath } from '@/uni_modules/lime-file-utils'
|
||||||
// export const getLocalFilePath = (path : string) : string => {
|
// export const getLocalFilePath = (path : string) : string => {
|
||||||
// let uri = path
|
// let uri = path
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.uts'
|
export * from './uvue.uts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
@ -1,5 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
export function getRect(selector : string, context: ComponentInternalInstance):Promise<NodeInfo> {
|
export function getRect(selector : string, context: ComponentPublicInstance):Promise<NodeInfo> {
|
||||||
return new Promise((resolve)=>{
|
return new Promise((resolve)=>{
|
||||||
uni.createSelectorQuery().in(context).select(selector).boundingClientRect(res =>{
|
uni.createSelectorQuery().in(context).select(selector).boundingClientRect(res =>{
|
||||||
resolve(res as NodeInfo)
|
resolve(res as NodeInfo)
|
||||||
@ -7,7 +7,7 @@ export function getRect(selector : string, context: ComponentInternalInstance):P
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAllRect(selector : string, context: ComponentInternalInstance):Promise<NodeInfo[]> {
|
export function getAllRect(selector : string, context: ComponentPublicInstance):Promise<NodeInfo[]> {
|
||||||
return new Promise((resolve)=>{
|
return new Promise((resolve)=>{
|
||||||
uni.createSelectorQuery().in(context).selectAll(selector).boundingClientRect(res =>{
|
uni.createSelectorQuery().in(context).selectAll(selector).boundingClientRect(res =>{
|
||||||
resolve(res as NodeInfo[])
|
resolve(res as NodeInfo[])
|
||||||
|
@ -12,7 +12,7 @@ const dom = uni.requireNativePlugin('dom')
|
|||||||
* @param node 是否获取node
|
* @param node 是否获取node
|
||||||
* @returns 包含节点信息的 Promise 对象
|
* @returns 包含节点信息的 Promise 对象
|
||||||
*/
|
*/
|
||||||
export function getRect(selector : string, context : ComponentInternalInstance, node: boolean = false) {
|
export function getRect(selector : string, context : ComponentInternalInstance|ComponentPublicInstance, node: boolean = false) {
|
||||||
// 之前是个对象,现在改成实例,防止旧版会报错
|
// 之前是个对象,现在改成实例,防止旧版会报错
|
||||||
if(context== null) {
|
if(context== null) {
|
||||||
return Promise.reject('context is null')
|
return Promise.reject('context is null')
|
||||||
@ -67,7 +67,7 @@ export function getRect(selector : string, context : ComponentInternalInstance,
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export function getAllRect(selector : string, context: ComponentInternalInstance, node:boolean = false) {
|
export function getAllRect(selector : string, context: ComponentInternalInstance|ComponentPublicInstance, node:boolean = false) {
|
||||||
if(context== null) {
|
if(context== null) {
|
||||||
return Promise.reject('context is null')
|
return Promise.reject('context is null')
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
interface CSSProperties {
|
interface CSSProperties {
|
||||||
[key : string] : string | number | null
|
[key : string] : string | number | null
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef VUE3
|
// #ifdef VUE3
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
type CSSProperties = UTSJSONObject
|
type CSSProperties = UTSJSONObject
|
||||||
// #endif
|
// #endif
|
||||||
// #endif
|
// #endif
|
||||||
@ -26,7 +26,7 @@ export function toLowercaseSeparator(key : string):string {
|
|||||||
*/
|
*/
|
||||||
export function getStyleStr(style : CSSProperties) : string {
|
export function getStyleStr(style : CSSProperties) : string {
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
let styleStr = '';
|
let styleStr = '';
|
||||||
style.toMap().forEach((value, key) => {
|
style.toMap().forEach((value, key) => {
|
||||||
if(value !== null && value != '') {
|
if(value !== null && value != '') {
|
||||||
@ -35,7 +35,7 @@ export function getStyleStr(style : CSSProperties) : string {
|
|||||||
})
|
})
|
||||||
return styleStr
|
return styleStr
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
return Object.keys(style)
|
return Object.keys(style)
|
||||||
.filter(
|
.filter(
|
||||||
(key) =>
|
(key) =>
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.ts'
|
export * from './uvue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
@ -13,10 +13,10 @@ export function isDef(value: unknown): boolean {
|
|||||||
|
|
||||||
// #ifdef UNI-APP-X
|
// #ifdef UNI-APP-X
|
||||||
export function isDef(value : any|null) : boolean {
|
export function isDef(value : any|null) : boolean {
|
||||||
// #ifdef APP-ANDROID || APP-IOS
|
// #ifdef UNI-APP-X && APP
|
||||||
return value != null;
|
return value != null;
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef APP-ANDROID || APP-IOS
|
// #ifndef UNI-APP-X && APP
|
||||||
return value != null && value != undefined;
|
return value != null && value != undefined;
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import {isNumber} from '../isNumber'
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export function isEmpty(value : any | null) : boolean {
|
export function isEmpty(value : any | null) : boolean {
|
||||||
// 为null
|
// 为null
|
||||||
if(!isDef(value)){
|
if(!isDef(value)){
|
||||||
@ -55,7 +55,7 @@ export function isEmpty(value : any | null) : boolean {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export function isEmpty(value: any): boolean {
|
export function isEmpty(value: any): boolean {
|
||||||
// 检查是否为null或undefined
|
// 检查是否为null或undefined
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
* @returns 如果值的类型是函数类型,则返回 true;否则返回 false
|
* @returns 如果值的类型是函数类型,则返回 true;否则返回 false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export const isFunction = (val: any):boolean => typeof val == 'function';
|
export const isFunction = (val: any):boolean => typeof val == 'function';
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export const isFunction = (val: unknown): val is Function =>
|
export const isFunction = (val: unknown): val is Function =>
|
||||||
typeof val === 'function';
|
typeof val === 'function';
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -19,7 +19,7 @@ export function isNumber(value: any|null): boolean {
|
|||||||
// #ifdef APP-IOS
|
// #ifdef APP-IOS
|
||||||
return ['Int8', 'UInt8','Int16','UInt16','Int32','UInt32','Int64','UInt64','Int','UInt','Float','Float16','Float32','Float64','Double', 'number'].includes(typeof value)
|
return ['Int8', 'UInt8','Int16','UInt16','Int32','UInt32','Int64','UInt64','Int','UInt','Float','Float16','Float32','Float64','Double', 'number'].includes(typeof value)
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef APP-ANDROID || APP-IOS
|
// #ifndef UNI-APP-X && APP
|
||||||
return typeof value === 'number' && !isNaN(value);
|
return typeof value === 'number' && !isNaN(value);
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
* @returns 如果值是数字类型或表示数字的字符串,则返回 true;否则返回 false
|
* @returns 如果值是数字类型或表示数字的字符串,则返回 true;否则返回 false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export function isNumeric(value: string | number | undefined | null): boolean {
|
export function isNumeric(value: string | number | undefined | null): boolean {
|
||||||
return /^(-)?\d+(\.\d+)?$/.test(value);
|
return /^(-)?\d+(\.\d+)?$/.test(value);
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
import {isNumber} from '../isNumber';
|
import {isNumber} from '../isNumber';
|
||||||
import {isString} from '../isString';
|
import {isString} from '../isString';
|
||||||
export function isNumeric(value : any|null) : boolean {
|
export function isNumeric(value : any|null) : boolean {
|
||||||
|
@ -5,14 +5,14 @@
|
|||||||
* @returns 如果值的类型是对象类型,则返回 true;否则返回 false
|
* @returns 如果值的类型是对象类型,则返回 true;否则返回 false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export const isObject = (val : unknown) : val is Record<any, any> =>
|
export const isObject = (val : unknown) : val is Record<any, any> =>
|
||||||
val !== null && typeof val === 'object';
|
val !== null && typeof val === 'object';
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export const isObject = (val : any | null) : boolean =>{
|
export const isObject = (val : any | null) : boolean =>{
|
||||||
return val !== null && typeof val === 'object';
|
return val !== null && typeof val === 'object';
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* @param str 要检查的值
|
* @param str 要检查的值
|
||||||
* @returns 如果值的类型是字符串类型,则返回 true;否则返回 false
|
* @returns 如果值的类型是字符串类型,则返回 true;否则返回 false
|
||||||
*/
|
*/
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
// export const isString = (str: unknown): str is string => typeof str === 'string';
|
// export const isString = (str: unknown): str is string => typeof str === 'string';
|
||||||
export function isString (str: unknown): str is string {
|
export function isString (str: unknown): str is string {
|
||||||
return typeof str == 'string'
|
return typeof str == 'string'
|
||||||
@ -12,8 +12,8 @@ export function isString (str: unknown): str is string {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export function isString (str: any): boolean {
|
export function isString (str: any|null): boolean {
|
||||||
return typeof str == 'string'
|
return typeof str == 'string'
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
export function kebabCase(str : string, separator : string = "-") : string {
|
export function kebabCase(str : string, separator : string = "-") : string {
|
||||||
return str
|
return str
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
.replace(/[A-Z]/g, (match : string, _ : number, _ : string) : string => `${separator}${match.toLowerCase()}`) // 将大写字母替换为连接符加小写字母
|
.replace(/[A-Z]/g, (match : string, _ : number, _ : string) : string => `${separator}${match.toLowerCase()}`) // 将大写字母替换为连接符加小写字母
|
||||||
// #endif
|
// #endif
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
.replace(/[A-Z]/g, (match : string) : string => `${separator}${match.toLowerCase()}`) // 将大写字母替换为连接符加小写字母
|
.replace(/[A-Z]/g, (match : string) : string => `${separator}${match.toLowerCase()}`) // 将大写字母替换为连接符加小写字母
|
||||||
// #endif
|
// #endif
|
||||||
.replace(/[\s_-]+/g, separator) // 将空格、下划线和短横线替换为指定连接符
|
.replace(/[\s_-]+/g, separator) // 将空格、下划线和短横线替换为指定连接符
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "lime-shared",
|
"id": "lime-shared",
|
||||||
"displayName": "lime-shared",
|
"displayName": "lime-shared",
|
||||||
"version": "0.1.6",
|
"version": "0.2.7",
|
||||||
"description": "本人插件的几个公共函数,获取当前页,图片的base64转临时路径,图片的exif信息等",
|
"description": "本人插件的几个公共函数,获取当前页,图片的base64转临时路径,图片的exif信息等",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"lime-shared",
|
"lime-shared",
|
||||||
@ -50,7 +50,8 @@
|
|||||||
"App": {
|
"App": {
|
||||||
"app-vue": "y",
|
"app-vue": "y",
|
||||||
"app-uvue": "y",
|
"app-uvue": "y",
|
||||||
"app-nvue": "y"
|
"app-nvue": "y",
|
||||||
|
"app-harmony": "u"
|
||||||
},
|
},
|
||||||
"H5-mobile": {
|
"H5-mobile": {
|
||||||
"Safari": "y",
|
"Safari": "y",
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './vue.ts'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './uvue.uts'
|
export * from './uvue.uts'
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export * from './vue.ts'
|
export * from './uvue'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export * from './uvue.ts'
|
export * from './vue'
|
||||||
// #endif
|
// #endif
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// import {isBrowser} from '../isBrowser'
|
|
||||||
|
|
||||||
// 是否支持被动事件监听
|
// 是否支持被动事件监听
|
||||||
export const supportsPassive = true;
|
export const supportsPassive = true;
|
||||||
|
|
||||||
|
// #ifdef uniVersion < 4.25
|
||||||
// 请求动画帧
|
// 请求动画帧
|
||||||
export function raf(fn: TimerCallback): number {
|
export function raf(fn: TimerCallback): number {
|
||||||
return setTimeout(fn, 1000 / 30);
|
return setTimeout(fn, 1000 / 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 取消动画帧
|
// 取消动画帧
|
||||||
@ -14,7 +13,36 @@ export function cancelRaf(id: number) {
|
|||||||
clearTimeout(id);
|
clearTimeout(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 双倍动画帧
|
// 双倍动画帧
|
||||||
export function doubleRaf(fn: TimerCallback): void {
|
export function doubleRaf(fn: TimerCallback): void {
|
||||||
raf(() => raf(fn)); // 在下一帧回调中再次请求动画帧,实现双倍动画帧效果
|
raf(():number => raf(fn)); // 在下一帧回调中再次请求动画帧,实现双倍动画帧效果
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
// #ifdef uniVersion >= 4.25
|
||||||
|
// 请求动画帧
|
||||||
|
export function raf(fn: UniAnimationFrameCallback): number
|
||||||
|
export function raf(fn: UniAnimationFrameCallbackWithNoArgument): number
|
||||||
|
export function raf(fn: any): number {
|
||||||
|
if(typeof fn == 'UniAnimationFrameCallback') {
|
||||||
|
return requestAnimationFrame(fn as UniAnimationFrameCallback);
|
||||||
|
} else {
|
||||||
|
return requestAnimationFrame(fn as UniAnimationFrameCallbackWithNoArgument);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消动画帧
|
||||||
|
export function cancelRaf(id: number) {
|
||||||
|
cancelAnimationFrame(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 双倍动画帧
|
||||||
|
export function doubleRaf(fn: UniAnimationFrameCallback): void
|
||||||
|
export function doubleRaf(fn: UniAnimationFrameCallbackWithNoArgument): void
|
||||||
|
export function doubleRaf(fn: any): void {
|
||||||
|
raf(():number => raf(fn)); // 在下一帧回调中再次请求动画帧,实现双倍动画帧效果
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
// import { isBrowser } from '../isBrowser'
|
|
||||||
type Callback = () => void//Function
|
type Callback = () => void//Function
|
||||||
// 是否支持被动事件监听
|
// 是否支持被动事件监听
|
||||||
export const supportsPassive = true;
|
export const supportsPassive = true;
|
||||||
@ -7,7 +6,7 @@ export const supportsPassive = true;
|
|||||||
// 请求动画帧
|
// 请求动画帧
|
||||||
export function raf(fn : Callback) : number {
|
export function raf(fn : Callback) : number {
|
||||||
// #ifndef WEB
|
// #ifndef WEB
|
||||||
return setTimeout(fn, 1000 / 30); // 请求动画帧
|
return setTimeout(fn, 1000 / 60); // 请求动画帧
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef WEB
|
// #ifdef WEB
|
||||||
return requestAnimationFrame(fn); // 请求动画帧
|
return requestAnimationFrame(fn); // 请求动画帧
|
||||||
|
@ -32,6 +32,7 @@ import {getRect} from '@/uni_modules/lime-shared/getRect'
|
|||||||
+ [camelCase](#api_camelCase): 字符串转换为 camelCase 或 PascalCase 风格的命名约定
|
+ [camelCase](#api_camelCase): 字符串转换为 camelCase 或 PascalCase 风格的命名约定
|
||||||
+ [kebabCase](#api_kebabCase): 将字符串转换为指定连接符的命名约定
|
+ [kebabCase](#api_kebabCase): 将字符串转换为指定连接符的命名约定
|
||||||
+ [closest](#api_closest): 在给定数组中找到最接近目标数字的元素
|
+ [closest](#api_closest): 在给定数组中找到最接近目标数字的元素
|
||||||
|
+ [shuffle](#api_shuffle): 将给定的数组打乱
|
||||||
+ [isBase64](#api_isBase64): 判断字符串是否为base64
|
+ [isBase64](#api_isBase64): 判断字符串是否为base64
|
||||||
+ [isNumber](#api_isNumber): 检查一个值是否为数字类型
|
+ [isNumber](#api_isNumber): 检查一个值是否为数字类型
|
||||||
+ [isNumeric](#api_isNumeric): 检查一个值是否为数字类型或表示数字的字符串
|
+ [isNumeric](#api_isNumeric): 检查一个值是否为数字类型或表示数字的字符串
|
||||||
@ -371,6 +372,19 @@ closest([1, 3, 5, 7, 9], 6) // 5
|
|||||||
| √ | √ |
|
| √ | √ |
|
||||||
|
|
||||||
|
|
||||||
|
### shuffle <a id="api_shuffle"></a>
|
||||||
|
- 在给定数组中找到最接近目标数字的元素
|
||||||
|
|
||||||
|
```js
|
||||||
|
shuffle([1, 3, 5, 7, 9])
|
||||||
|
```
|
||||||
|
|
||||||
|
##### 兼容性
|
||||||
|
| uni-app | uni-app x |
|
||||||
|
|------------|----------------------------------|
|
||||||
|
| √ | √ |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### isBase64 <a id="api_isBase64"></a>
|
### isBase64 <a id="api_isBase64"></a>
|
||||||
- 判断字符串是否为base64
|
- 判断字符串是否为base64
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
function sleep(delay: number = 300):Promise<boolean> {
|
function sleep(delay: number = 300):Promise<boolean> {
|
||||||
return new Promise((resolve):void => {setTimeout(() => {resolve(true)}, delay)});
|
return new Promise((resolve):void => {setTimeout(() => {resolve(true)}, delay)});
|
||||||
}
|
}
|
||||||
@ -16,7 +16,7 @@ export {
|
|||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export const sleep = (delay: number = 300) =>
|
export const sleep = (delay: number = 300) =>
|
||||||
new Promise(resolve => setTimeout(resolve, delay));
|
new Promise(resolve => setTimeout(resolve, delay));
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* @returns 节流后的函数
|
* @returns 节流后的函数
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export function throttle(fn: (...args: any[]) => void, delay: number) {
|
export function throttle(fn: (...args: any[]) => void, delay: number) {
|
||||||
let flag = true; // 标记是否可以执行函数
|
let flag = true; // 标记是否可以执行函数
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ export function throttle(fn: (...args: any[]) => void, delay: number) {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
// type Rfun = (...args: any[]) => void
|
// type Rfun = (...args: any[]) => void
|
||||||
// type Rfun = (...args: any[]) => void
|
// type Rfun = (...args: any[]) => void
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
* @param item 要转换为数组的元素
|
* @param item 要转换为数组的元素
|
||||||
* @returns 转换后的数组
|
* @returns 转换后的数组
|
||||||
*/
|
*/
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export const toArray = <T>(item: T | T[]): T[] => Array.isArray(item) ? item : [item];
|
export const toArray = <T>(item: T | T[]): T[] => Array.isArray(item) ? item : [item];
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
export function toArray<T extends any>(item: any): T[] {
|
export function toArray<T extends any>(item: any): T[] {
|
||||||
return Array.isArray(item) ? item as T[] : [item as T]// as T[]
|
return Array.isArray(item) ? item as T[] : [item as T]// as T[]
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ import { isString } from '../isString'
|
|||||||
// function toBoolean(value : number) : boolean;
|
// function toBoolean(value : number) : boolean;
|
||||||
// function toBoolean(value : boolean) : boolean;
|
// function toBoolean(value : boolean) : boolean;
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
function toBoolean(value : any | null) : boolean {
|
function toBoolean(value : any | null) : boolean {
|
||||||
// 根据输入值的类型,返回相应的布尔值
|
// 根据输入值的类型,返回相应的布尔值
|
||||||
// if (isNumber(value)) {
|
// if (isNumber(value)) {
|
||||||
@ -29,7 +29,7 @@ function toBoolean(value : any | null) : boolean {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
function toBoolean(value : any | null) : value is NonNullable<typeof value> {
|
function toBoolean(value : any | null) : value is NonNullable<typeof value> {
|
||||||
return !!value//value !== null && value !== undefined;
|
return !!value//value !== null && value !== undefined;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* @returns 转换后的数字或原始字符串
|
* @returns 转换后的数字或原始字符串
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
// function toNumber(val: string): number
|
// function toNumber(val: string): number
|
||||||
// function toNumber(val: string): string
|
// function toNumber(val: string): string
|
||||||
function toNumber(val: string): number|null {
|
function toNumber(val: string): number|null {
|
||||||
@ -15,7 +15,7 @@ function toNumber(val: string): number|null {
|
|||||||
export {toNumber}
|
export {toNumber}
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export function toNumber(val: string): number | string {
|
export function toNumber(val: string): number | string {
|
||||||
const n = parseFloat(val); // 使用 parseFloat 函数将字符串转换为浮点数
|
const n = parseFloat(val); // 使用 parseFloat 函数将字符串转换为浮点数
|
||||||
return isNaN(n) ? val : n; // 使用 isNaN 函数判断是否为非数字,返回转换后的数字或原始字符串
|
return isNaN(n) ? val : n; // 使用 isNaN 函数判断是否为非数字,返回转换后的数字或原始字符串
|
||||||
|
@ -7,8 +7,8 @@ import { isNumeric } from '../isNumeric'
|
|||||||
* @param value 要转换的值,可以是字符串数字或带有单位的字符串
|
* @param value 要转换的值,可以是字符串数字或带有单位的字符串
|
||||||
* @returns 转换后的数字,如果无法转换则返回0
|
* @returns 转换后的数字,如果无法转换则返回0
|
||||||
*/
|
*/
|
||||||
// #ifndef APP-IOS || APP-ANDROID
|
// #ifndef UNI-APP-X && APP
|
||||||
export function unitConvert(value : string | number) : number {
|
export function unitConvert(value : string | number, base: number = 0) : number {
|
||||||
// 如果是字符串数字
|
// 如果是字符串数字
|
||||||
if (isNumeric(value)) {
|
if (isNumeric(value)) {
|
||||||
return Number(value);
|
return Number(value);
|
||||||
@ -21,12 +21,15 @@ export function unitConvert(value : string | number) : number {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const unit = results[3];
|
const unit = results[3];
|
||||||
value = parseFloat(value);
|
const _value = parseFloat(value);
|
||||||
if (unit === 'rpx') {
|
if (unit === 'rpx') {
|
||||||
return uni.upx2px(value);
|
return uni.upx2px(_value);
|
||||||
}
|
}
|
||||||
if (unit === 'px') {
|
if (unit === 'px') {
|
||||||
return value * 1;
|
return _value * 1;
|
||||||
|
}
|
||||||
|
if(unit == '%') {
|
||||||
|
return _value / 100 * base
|
||||||
}
|
}
|
||||||
// 如果是其他单位,可以继续添加对应的转换逻辑
|
// 如果是其他单位,可以继续添加对应的转换逻辑
|
||||||
}
|
}
|
||||||
@ -35,9 +38,9 @@ export function unitConvert(value : string | number) : number {
|
|||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
// #ifdef APP-IOS || APP-ANDROID
|
// #ifdef UNI-APP-X && APP
|
||||||
import { isNumber } from '../isNumber'
|
import { isNumber } from '../isNumber'
|
||||||
export function unitConvert(value : any | null) : number {
|
export function unitConvert(value : any | null, base: number = 0) : number {
|
||||||
if (isNumber(value)) {
|
if (isNumber(value)) {
|
||||||
return value as number
|
return value as number
|
||||||
}
|
}
|
||||||
@ -53,13 +56,17 @@ export function unitConvert(value : any | null) : number {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
const unit = results[3];
|
const unit = results[3];
|
||||||
const v = parseFloat(value);
|
const _value = parseFloat(value);
|
||||||
if (unit == 'rpx') {
|
if (unit == 'rpx') {
|
||||||
const { windowWidth } = uni.getWindowInfo()
|
// const { windowWidth } = uni.getWindowInfo()
|
||||||
return windowWidth / 750 * v;
|
// return windowWidth / 750 * _value;
|
||||||
|
return uni.rpx2px(_value)
|
||||||
}
|
}
|
||||||
if (unit == 'px') {
|
if (unit == 'px') {
|
||||||
return v;
|
return _value;
|
||||||
|
}
|
||||||
|
if(unit == '%') {
|
||||||
|
return _value / 100 * base
|
||||||
}
|
}
|
||||||
// 如果是其他单位,可以继续添加对应的转换逻辑
|
// 如果是其他单位,可以继续添加对应的转换逻辑
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user