Merge remote-tracking branch 'remotes/origin/master' into yzqUniapp
# Conflicts: # pages.json
This commit is contained in:
commit
6116c47a34
@ -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
|
|
||||||
|
|||||||
16
api/common.js
Normal file
16
api/common.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import {
|
||||||
|
https
|
||||||
|
} from '@/utils/http.js';
|
||||||
|
/*
|
||||||
|
这是后端系统通用的系统类的基础性的api路径,后续的大家分类建js存放
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export function initDictOption(dictCode) { // 获取部门所有人员信息
|
||||||
|
return https({
|
||||||
|
url: ' /sys/dict/getDictItems',
|
||||||
|
method: 'get',
|
||||||
|
data: dictCode
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -81,3 +81,27 @@ 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 cxcRyDatAstatisticsCertificate(parm) { // 员工按证件分组统计
|
||||||
|
return https({
|
||||||
|
url: '/cxc_rlzy.zb/cxcRlzyZb/getStatisticsCertificate',
|
||||||
|
method: 'get',
|
||||||
|
data: parm
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function cxcRyDatAstatisticsDetails(parm) { // 员工信息统计
|
||||||
|
return https({
|
||||||
|
url: '/cxc_rlzy.zb/cxcRlzyZb/details',
|
||||||
|
method: 'get',
|
||||||
|
data: parm
|
||||||
|
})
|
||||||
|
}
|
||||||
95
package-lock.json
generated
95
package-lock.json
generated
@ -1,95 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "cxc-szcx-uniapp",
|
|
||||||
"lockfileVersion": 2,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"dependencies": {
|
|
||||||
"@dcloudio/uni-ui": "^1.5.6",
|
|
||||||
"base-64": "^1.0.0",
|
|
||||||
"dayjs": "^1.11.13",
|
|
||||||
"echarts": "^5.6.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@dcloudio/uni-ui": {
|
|
||||||
"version": "1.5.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/@dcloudio/uni-ui/-/uni-ui-1.5.6.tgz",
|
|
||||||
"integrity": "sha512-jmb98PasFvZkrIDXGh94GbdWg2/jyhgs1HUG+bU8eyL7Ltias/5XBz4q8w9RXyWUfqepJRqapPA2IIQpLCuTIg==",
|
|
||||||
"license": "Apache-2.0"
|
|
||||||
},
|
|
||||||
"node_modules/base-64": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/base-64/-/base-64-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="
|
|
||||||
},
|
|
||||||
"node_modules/dayjs": {
|
|
||||||
"version": "1.11.13",
|
|
||||||
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
|
|
||||||
"integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg=="
|
|
||||||
},
|
|
||||||
"node_modules/echarts": {
|
|
||||||
"version": "5.6.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/echarts/-/echarts-5.6.0.tgz",
|
|
||||||
"integrity": "sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"tslib": "2.3.0",
|
|
||||||
"zrender": "5.6.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/tslib": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==",
|
|
||||||
"license": "0BSD"
|
|
||||||
},
|
|
||||||
"node_modules/zrender": {
|
|
||||||
"version": "5.6.1",
|
|
||||||
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.6.1.tgz",
|
|
||||||
"integrity": "sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==",
|
|
||||||
"license": "BSD-3-Clause",
|
|
||||||
"dependencies": {
|
|
||||||
"tslib": "2.3.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@dcloudio/uni-ui": {
|
|
||||||
"version": "1.5.6",
|
|
||||||
"resolved": "https://registry.npmjs.org/@dcloudio/uni-ui/-/uni-ui-1.5.6.tgz",
|
|
||||||
"integrity": "sha512-jmb98PasFvZkrIDXGh94GbdWg2/jyhgs1HUG+bU8eyL7Ltias/5XBz4q8w9RXyWUfqepJRqapPA2IIQpLCuTIg=="
|
|
||||||
},
|
|
||||||
"base-64": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/base-64/-/base-64-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg=="
|
|
||||||
},
|
|
||||||
"dayjs": {
|
|
||||||
"version": "1.11.13",
|
|
||||||
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.13.tgz",
|
|
||||||
"integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg=="
|
|
||||||
},
|
|
||||||
"echarts": {
|
|
||||||
"version": "5.6.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/echarts/-/echarts-5.6.0.tgz",
|
|
||||||
"integrity": "sha512-oTbVTsXfKuEhxftHqL5xprgLoc0k7uScAwtryCgWF6hPYFLRwOUHiFmHGCBKP5NPFNkDVopOieyUqYGH8Fa3kA==",
|
|
||||||
"requires": {
|
|
||||||
"tslib": "2.3.0",
|
|
||||||
"zrender": "5.6.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tslib": {
|
|
||||||
"version": "2.3.0",
|
|
||||||
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz",
|
|
||||||
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
|
|
||||||
},
|
|
||||||
"zrender": {
|
|
||||||
"version": "5.6.1",
|
|
||||||
"resolved": "https://registry.npmmirror.com/zrender/-/zrender-5.6.1.tgz",
|
|
||||||
"integrity": "sha512-OFXkDJKcrlx5su2XbzJvj/34Q3m6PvyCZkVPHGYpcCJ52ek4U/ymZyfuV1nKE23AyBJ51E/6Yr0mhZ7xGTO4ag==",
|
|
||||||
"requires": {
|
|
||||||
"tslib": "2.3.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
26
pages.json
26
pages.json
@ -233,6 +233,13 @@
|
|||||||
"navigationBarTitleText": "人员年龄分组统计信息",
|
"navigationBarTitleText": "人员年龄分组统计信息",
|
||||||
"navigationBarTextStyle": "white"
|
"navigationBarTextStyle": "white"
|
||||||
|
|
||||||
|
}
|
||||||
|
{
|
||||||
|
"path": "pages/views/renliziyuan/renyuanxinxi/qttongji",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "其他统计信息",
|
||||||
|
"navigationBarTextStyle": "white"
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -242,6 +249,25 @@
|
|||||||
"navigationBarTextStyle": "white"
|
"navigationBarTextStyle": "white"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}<<<<<<< .mine
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/views/renliziyuan/qingjiaxinxi/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "请假信息",
|
||||||
|
"navigationBarTextStyle": "white"
|
||||||
|
|
||||||
|
}
|
||||||
|
=======
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/views/renliziyuan/renyuanxinxi/qttongji",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "其他统计信息",
|
||||||
|
"navigationBarTextStyle": "white"
|
||||||
|
|
||||||
|
}
|
||||||
|
>>>>>>> .theirs
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
|
|||||||
@ -98,17 +98,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
/*生产环境 begin */
|
/*生产环境 begin */
|
||||||
// loginApi({
|
loginApi({
|
||||||
// username: un,
|
username: un,
|
||||||
// password: pw,
|
password: pw,
|
||||||
// ip: getDeviceIp()
|
ip: getDeviceIp()
|
||||||
/*生产环境 end */
|
/*生产环境 end */
|
||||||
|
|
||||||
/*开发环境 begin */
|
/*开发环境 begin */
|
||||||
localLoginApi({
|
// localLoginApi({
|
||||||
username: username.value,
|
// username: username.value,
|
||||||
password: password.value,
|
// password: password.value,
|
||||||
captcha: 'app'
|
// captcha: 'app'
|
||||||
/*开发环境 end */
|
/*开发环境 end */
|
||||||
}).then((loginres) => {
|
}).then((loginres) => {
|
||||||
if (loginres.success) {
|
if (loginres.success) {
|
||||||
|
|||||||
@ -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>
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -8,28 +8,35 @@
|
|||||||
</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>
|
||||||
|
</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 toQtTongji() {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/views/renliziyuan/renyuanxinxi/qttongji'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style></style>
|
||||||
</style>
|
|
||||||
985
pages/views/renliziyuan/renyuanxinxi/qttongji.vue
Normal file
985
pages/views/renliziyuan/renyuanxinxi/qttongji.vue
Normal file
@ -0,0 +1,985 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="container" id="top1">
|
||||||
|
<uni-row style="margin-bottom: 10px">
|
||||||
|
<uni-col :span="5"><uni-title :title="'选择单位'" align="left" type="h4"></uni-title></uni-col>
|
||||||
|
<uni-col :span="19">
|
||||||
|
<trq-depart-select v-model="selectedOrgCode" returnCodeOrID="orgCode"
|
||||||
|
@change="onOrgCodeChange"></trq-depart-select>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<uni-row style="margin-bottom: 10px">
|
||||||
|
<uni-col :span="5"><uni-title :title="'选择字段'" align="left" type="h4"></uni-title></uni-col>
|
||||||
|
<uni-col :span="12">
|
||||||
|
<uni-data-select v-model="selectedField" :localdata="fieldList"
|
||||||
|
@change="onFieldChange"></uni-data-select>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col style="margin-left:5px" :span="6" v-if="selectedField==='zjmc'"><button type="primary"
|
||||||
|
size="mini" @click="showPopup=!showPopup">筛选</button></uni-col>
|
||||||
|
</uni-row>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<!-- ECharts图表 -->
|
||||||
|
<view class="chart-container">
|
||||||
|
<l-echart ref="chart" @finished="initChart" />
|
||||||
|
</view>
|
||||||
|
<!-- 翻页按钮 -->
|
||||||
|
<view style="display: flex; justify-content: center; margin-top: 10px">
|
||||||
|
<button @click="prevPage" :disabled="currentPage === 1" size="mini">上一页</button>
|
||||||
|
<button @click="nextPage" :disabled="currentPage * pageSize >= chartDataCount.value"
|
||||||
|
size="mini">下一页</button>
|
||||||
|
</view>
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<uni-row style="margin-top: 10px; margin-left: 20px; margin-right: 20px" v-if="personnelList.length > 0">
|
||||||
|
<uni-col :span="2">
|
||||||
|
<view class="titleStyle">序号</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="4">
|
||||||
|
<view class="titleStyle">姓名</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5">
|
||||||
|
<view class="titleStyle">基层单位</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5" v-if="selectedField.value !== 'zjmc'">
|
||||||
|
<view class="titleStyle">基层班组</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5" v-else>
|
||||||
|
<view class="titleStyle">岗位</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="4">
|
||||||
|
<view class="titleStyle">年龄</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="4">
|
||||||
|
<view class="titleStyle">操作</view>
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
<scroll-view scroll-y :style="{ height: bottomHeight + 'px' }">
|
||||||
|
<uni-row style="margin-bottom: 10px; margin-left: 20px; margin-right: 20px; font-size: 12px">
|
||||||
|
<view v-for="(item, index) in personnelList">
|
||||||
|
<uni-col :span="2">
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{ index + 1 }}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="4">
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{ item.xm }}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
|
||||||
|
<uni-col :span="5">
|
||||||
|
<view class="dataStyle1">
|
||||||
|
{{ item.jcdw }}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="5" v-if="selectedField.value != 'zjmc'">
|
||||||
|
<view class="dataStyle1">
|
||||||
|
{{ item.jcxd }}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="4" v-else>
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{ item.sdgw }}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
<uni-col :span="4">
|
||||||
|
<view class="dataStyle">
|
||||||
|
{{ item.nl }}
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
|
||||||
|
<uni-col :span="4">
|
||||||
|
<view class="dataStyle">
|
||||||
|
<span @click="detail(item)" style="color: red;">详情</span>
|
||||||
|
<!-- <button size="mini" type="primary" @click="detail(item)">详情</button> -->
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
</view>
|
||||||
|
</uni-row>
|
||||||
|
</scroll-view>
|
||||||
|
<uni-popup ref="showPopup" type="bottom" border-radius="10px 10px 0 0">
|
||||||
|
<uni-card>
|
||||||
|
<uni-title :title="'已选证书:'" align="left" type="h4"></uni-title>
|
||||||
|
<view style="color: red;font-weight: 300;margin-bottom: 10px;">{{dictData}}</view>
|
||||||
|
<scroll-view scroll-y style="height: 40vh;">
|
||||||
|
<view>
|
||||||
|
<cxc-szcx-dictSelect :dictCode="dictCode" @change="dictChange"></cxc-szcx-dictSelect>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</uni-card>
|
||||||
|
</uni-popup>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
reactive,
|
||||||
|
onMounted,
|
||||||
|
computed
|
||||||
|
} from 'vue';
|
||||||
|
import * as echarts from 'echarts/dist/echarts.min'; // 引入ECharts的H5版本
|
||||||
|
import {
|
||||||
|
cxcRyDatAstatistics,
|
||||||
|
cxcRyDatAstatisticsCertificate,
|
||||||
|
cxcRyDatAstatisticsDetails
|
||||||
|
} from '@/api/renyuan.js';
|
||||||
|
|
||||||
|
// 存储下方组件的高度 tableData
|
||||||
|
const bottomHeight = ref(0);
|
||||||
|
// 新增加载状态
|
||||||
|
const chart = ref(null);
|
||||||
|
const chartDataCount = ref(0);
|
||||||
|
const fieldList = ref([{
|
||||||
|
text: '取证情况',
|
||||||
|
value: 'zjmc',
|
||||||
|
isDict: false,
|
||||||
|
dictCode: 'gzrlzy',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '岗位类别',
|
||||||
|
value: 'gwlb',
|
||||||
|
isDict: false,
|
||||||
|
dictCode: ''
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '性别',
|
||||||
|
value: 'xb',
|
||||||
|
isDict: true,
|
||||||
|
dictCode: 'sex'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '政治面貌',
|
||||||
|
value: 'zzmm',
|
||||||
|
isDict: true,
|
||||||
|
dictCode: 'zzmm'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: '民族',
|
||||||
|
value: 'mz',
|
||||||
|
isDict: true,
|
||||||
|
dictCode: 'mz'
|
||||||
|
}
|
||||||
|
]); // 字段列表
|
||||||
|
|
||||||
|
const dictCode = ref('');
|
||||||
|
const dictData = ref('');
|
||||||
|
const showPopup = ref(null);
|
||||||
|
const fieldisDict = ref(true);
|
||||||
|
|
||||||
|
const selectedOrgCode = ref(''); // 当前选择的单位 orgCode
|
||||||
|
const selectedOrgCodeLabel = ref('请选择单位'); // 当前选择的单位名称
|
||||||
|
const selectedField = ref(''); // 当前选择的字段
|
||||||
|
const selectedFieldLabel = ref('请选择字段'); // 当前选择的字段名称
|
||||||
|
const orgCodeGroupData = ref([]); //按照orgcode进行分组的数据 含劳动合同号
|
||||||
|
const chartData = ref({}); // 图表数据
|
||||||
|
const personnelList = ref([]); // 人员列表 initChart
|
||||||
|
const fieldValues = ref([]); //字段值
|
||||||
|
const fieldTexts = ref([]); //字段值
|
||||||
|
const chartOption = ref({});
|
||||||
|
const orgType = ref(''); //记录单位层级 by 闵
|
||||||
|
|
||||||
|
const chartTitle = computed(() => {
|
||||||
|
return selectedOrgCodeLabel.value + '人员(' + selectedFieldLabel.value + ')分组统计';
|
||||||
|
});
|
||||||
|
|
||||||
|
//图标翻页
|
||||||
|
const pageSize = ref(3); // 每页显示的项目数量
|
||||||
|
const currentPage = ref(1); // 当前页码
|
||||||
|
|
||||||
|
function detail(record) {
|
||||||
|
// console.log(record)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/views/renliziyuan/renyuanxinxi/detail?data=' + encodeURIComponent(JSON.stringify(record))
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
|
||||||
|
getHeight();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
const dictChange = (e) => {
|
||||||
|
console.log(e)
|
||||||
|
dictData.value = e
|
||||||
|
fetchStatisticsData()
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 初始化 ECharts length departChange
|
||||||
|
// 初始化图表
|
||||||
|
const initChart = () => {
|
||||||
|
setTimeout(async () => {
|
||||||
|
if (!chart.value) return;
|
||||||
|
const myChart = await chart.value.init(echarts);
|
||||||
|
myChart.setOption(chartOption.value);
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
|
const prevPage = () => {
|
||||||
|
if (currentPage.value > 1) {
|
||||||
|
currentPage.value--;
|
||||||
|
}
|
||||||
|
updateChart(chartData.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
const nextPage = () => {
|
||||||
|
if (currentPage.value * pageSize.value < chartDataCount.value) {
|
||||||
|
currentPage.value++;
|
||||||
|
// 计算当前页数据的起始和结束索引
|
||||||
|
const startIndex = (currentPage.value - 1) * pageSize.value;
|
||||||
|
const endIndex = startIndex + pageSize.value;
|
||||||
|
updateChart(chartData.value);
|
||||||
|
// const tempChartData = temp.slice(startIndex, endIndex);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 更具数据生成图标的option
|
||||||
|
const getChartOption = (ChartData) => {
|
||||||
|
// let temp = JSON.parse(JSON.stringify(tempchartData[0].children));
|
||||||
|
// chartDataCount.value = temp.length;
|
||||||
|
// 计算当前页数据的起始和结束索引
|
||||||
|
|
||||||
|
const startIndex = (currentPage.value - 1) * pageSize.value;
|
||||||
|
const endIndex = startIndex + pageSize.value;
|
||||||
|
// 截取当前页的数据
|
||||||
|
const tempChartData = ChartData.slice(startIndex, endIndex);
|
||||||
|
try {
|
||||||
|
let xData = [];
|
||||||
|
let seriesData = [];
|
||||||
|
console.log(1, tempChartData);
|
||||||
|
//当前机构下的数据 transformDataForEcharts
|
||||||
|
|
||||||
|
let legendData = [];
|
||||||
|
for (let i = 0; i < fieldValues.value.length; i++) {
|
||||||
|
legendData.push(fieldValues.value[i].fieldText);
|
||||||
|
}
|
||||||
|
|
||||||
|
tempChartData.forEach((item) => {
|
||||||
|
xData.push(item.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (let i = 0; i < fieldValues.value.length; i++) {
|
||||||
|
let tempData = [];
|
||||||
|
tempChartData.forEach((item) => {
|
||||||
|
// console.log(item);
|
||||||
|
if (item.data[i]) {
|
||||||
|
tempData.push(item.data[i]);
|
||||||
|
} else {
|
||||||
|
tempData.push(0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
seriesData.push({
|
||||||
|
name: fieldValues.value[i].fieldText,
|
||||||
|
type: 'bar',
|
||||||
|
label: {
|
||||||
|
show: true, // 显示数值标签
|
||||||
|
position: 'top' // 数值标签位置
|
||||||
|
},
|
||||||
|
data: tempData
|
||||||
|
});
|
||||||
|
}
|
||||||
|
console.log(2, legendData, xData, seriesData);
|
||||||
|
|
||||||
|
let tempOption = {
|
||||||
|
title: {
|
||||||
|
text: chartTitle.value,
|
||||||
|
padding: [0, 0, 0, 30]
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
padding: [0, 30, 0, 0],
|
||||||
|
show: true,
|
||||||
|
feature: {
|
||||||
|
//工具配置项
|
||||||
|
|
||||||
|
restore: {
|
||||||
|
show: true //是否显示该工具
|
||||||
|
},
|
||||||
|
saveAsImage: {
|
||||||
|
show: true //是否显示该工具
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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,
|
||||||
|
|
||||||
|
legend: {
|
||||||
|
data: legendData,
|
||||||
|
itemGap: 1,
|
||||||
|
padding: [0, 0, 0, 0],
|
||||||
|
y: 'bottom',
|
||||||
|
itemHeight: 8, //高
|
||||||
|
itemWidth: 18, //宽
|
||||||
|
type: 'scroll'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return tempOption;
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 更新图表
|
||||||
|
const updateChart = (tempchartData) => {
|
||||||
|
// 初始化图表
|
||||||
|
setTimeout(async () => {
|
||||||
|
if (!chart.value) return;
|
||||||
|
const myChart = await chart.value.init(echarts);
|
||||||
|
console.log(tempchartData);
|
||||||
|
let tempOption = getChartOption(tempchartData);
|
||||||
|
|
||||||
|
myChart.setOption(tempOption);
|
||||||
|
// 点击钻取事件
|
||||||
|
myChart.on('click', (params) => {
|
||||||
|
console.log(params.name, params.seriesIndex, params.dataIndex);
|
||||||
|
console.log(orgCodeGroupData.value);
|
||||||
|
|
||||||
|
let updateData = findRyByOrgCode(orgCodeGroupData.value.children, params.name);
|
||||||
|
console.log(updateData);
|
||||||
|
|
||||||
|
const ldhth = updateData.fieldValues[params.seriesIndex].ldhth;
|
||||||
|
|
||||||
|
console.log(ldhth);
|
||||||
|
|
||||||
|
if (ldhth && ldhth.length > 0) {
|
||||||
|
fetchPersonnelList(ldhth);
|
||||||
|
}
|
||||||
|
// updateChart(updateData);
|
||||||
|
});
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
//根据一个键值查找数据
|
||||||
|
//查找人员劳动合同号
|
||||||
|
function findRyByOrgCode(treeData, targetOrgCode) {
|
||||||
|
// console.log(treeData, targetOrgCode);
|
||||||
|
for (const node of treeData) {
|
||||||
|
// 如果当前节点匹配,直接返回该节点及其子节点
|
||||||
|
if (node.orgText === targetOrgCode) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
// 递归检查子节点
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
const found = findNodeByOrgCode(node.children, targetOrgCode);
|
||||||
|
if (found) return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从echart图标的树状数据中根据 orgCode 获取节点及其子节点数据
|
||||||
|
* @param {Array} treeData 树状数据
|
||||||
|
* @param {string} targetOrgCode 目标 orgCode
|
||||||
|
* @returns {Object|null} 匹配的节点及其子节点数据,未找到返回 null
|
||||||
|
*/
|
||||||
|
function findNodeByOrgCode(treeData, targetOrgCode) {
|
||||||
|
// console.log(treeData, targetOrgCode);
|
||||||
|
for (const node of treeData) {
|
||||||
|
// 如果当前节点匹配,直接返回该节点及其子节点
|
||||||
|
if (node.name === targetOrgCode) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
// 递归检查子节点
|
||||||
|
if (node.children && node.children.length > 0) {
|
||||||
|
const found = findNodeByOrgCode(node.children, targetOrgCode);
|
||||||
|
if (found) return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取所有的fieldValue
|
||||||
|
function collectUniqueKeyFieldValues(tree) {
|
||||||
|
const uniqueMap = new Map();
|
||||||
|
tree.forEach((item) => {
|
||||||
|
const {
|
||||||
|
fieldValue,
|
||||||
|
fieldText
|
||||||
|
} = item;
|
||||||
|
const key = `${fieldValue}-${fieldText}`;
|
||||||
|
|
||||||
|
if (!uniqueMap.has(key)) {
|
||||||
|
uniqueMap.set(key, {
|
||||||
|
fieldValue,
|
||||||
|
fieldText
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const result = Array.from(uniqueMap.values());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 封装一个类来管理组织代码和组织名称的映射
|
||||||
|
class OrgCodeMapper {
|
||||||
|
constructor(data) {
|
||||||
|
// 初始化一个空对象用于存储映射关系
|
||||||
|
this.orgCodeToOrgTextMap = {};
|
||||||
|
// 遍历传入的数据数组
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
const item = data[i];
|
||||||
|
// 将 orgCode 作为键,orgText 作为值存入映射对象
|
||||||
|
this.orgCodeToOrgTextMap[item.orgCode] = item.orgText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找指定 orgCode 对应的 orgText 的方法
|
||||||
|
findOrgText(orgCode) {
|
||||||
|
return this.orgCodeToOrgTextMap[orgCode];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 示例用法
|
||||||
|
// const result = findNodeByOrgCode(echartData, "A01A01A01A01");
|
||||||
|
// console.log(result);
|
||||||
|
/**
|
||||||
|
* 转换数据为支持钻取的ECharts格式
|
||||||
|
* @param {Array} data 原始数据
|
||||||
|
* @param {string} selectOrgCode 当前选择的组织编码
|
||||||
|
* @returns {Object} 包含当前层级数据和子节点信息的对象 符合echart的格式
|
||||||
|
*/
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
|
function transformData(selectOrgCode, data) {
|
||||||
|
const nodes = new Map();
|
||||||
|
//获取所有的fieldValue 用于图例和钻取和data[]中的数据顺序保持一致 动态建立fieldValue的数据
|
||||||
|
fieldValues.value = collectUniqueKeyFieldValues(data);
|
||||||
|
// console.log(fieldValues.value);
|
||||||
|
const orgMapper = new OrgCodeMapper(data); //用于快速查找orgtext
|
||||||
|
// console.log(orgMapper.findOrgText('A01A01A01A01'));
|
||||||
|
// 获取orgCode的所有层级
|
||||||
|
function getHierarchy(orgCode) {
|
||||||
|
const hierarchy = [];
|
||||||
|
for (let i = selectOrgCode.length; i <= orgCode.length; i += 3) {
|
||||||
|
hierarchy.push(orgCode.substring(0, i));
|
||||||
|
}
|
||||||
|
// console.log('hierarchy', hierarchy);
|
||||||
|
return hierarchy;
|
||||||
|
}
|
||||||
|
// 获取父级orgCode
|
||||||
|
function getParentCode(code) {
|
||||||
|
if (code.length <= 3) return null;
|
||||||
|
return code.substring(0, code.length - 3);
|
||||||
|
}
|
||||||
|
// 动态赋值series的数据长度
|
||||||
|
let tempArrayValue = new Array(fieldValues.value.length).fill(0);
|
||||||
|
// 创建所有节点并建立父子关系
|
||||||
|
data.forEach((entry) => {
|
||||||
|
const hierarchy = getHierarchy(entry.orgCode);
|
||||||
|
// console.log(entry);
|
||||||
|
hierarchy.forEach((code) => {
|
||||||
|
// console.log(code);
|
||||||
|
let tempOrgText = orgMapper.findOrgText(code) === undefined ? '' : orgMapper.findOrgText(
|
||||||
|
code);
|
||||||
|
// console.log(tempOrgText);
|
||||||
|
if (!nodes.has(code)) {
|
||||||
|
nodes.set(code, {
|
||||||
|
orgCode: code,
|
||||||
|
name: tempOrgText,
|
||||||
|
type: 'bar',
|
||||||
|
data: JSON.parse(JSON.stringify(tempArrayValue)), // 初始化data为[0, 0] 动态
|
||||||
|
children: []
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// console.log(nodes);
|
||||||
|
// console.log('fieldValues', fieldValues.value, fieldValues.value.length, hierarchy);
|
||||||
|
|
||||||
|
// 更新当前节点的data
|
||||||
|
const node = nodes.get(entry.orgCode);
|
||||||
|
const fieldValue = entry.fieldValue;
|
||||||
|
|
||||||
|
for (let i = 0; i < fieldValues.value.length; i++) {
|
||||||
|
if (fieldValue === fieldValues.value[i].fieldValue) {
|
||||||
|
// console.log(555, i, fieldValue, fieldValues.value[i], entry.number);
|
||||||
|
node.data[i] += entry.number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(11, node);
|
||||||
|
|
||||||
|
// 建立父子关系
|
||||||
|
for (let i = 0; i < hierarchy.length - 1; i++) {
|
||||||
|
const parentCode = hierarchy[i];
|
||||||
|
const childCode = hierarchy[i + 1];
|
||||||
|
const parentNode = nodes.get(parentCode);
|
||||||
|
const childNode = nodes.get(childCode);
|
||||||
|
if (!parentNode.children.some((c) => c.orgCode === childCode)) {
|
||||||
|
parentNode.children.push(childNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 计算非叶子节点的data(子节点之和)
|
||||||
|
function computeData(node) {
|
||||||
|
if (node.children.length === 0) return;
|
||||||
|
node.data = JSON.parse(JSON.stringify(tempArrayValue));
|
||||||
|
node.children.forEach((child) => {
|
||||||
|
computeData(child);
|
||||||
|
for (let i = 0; i < fieldValues.value.length; i++) {
|
||||||
|
// console.log(666, i, node.data[i], child.data[i]);
|
||||||
|
node.data[i] += child.data[i];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取所有根节点(没有父节点或父节点不存在)
|
||||||
|
const rootNodes = [];
|
||||||
|
nodes.forEach((node, code) => {
|
||||||
|
const parentCode = getParentCode(code);
|
||||||
|
// console.log(parentCode);
|
||||||
|
if (!parentCode || !nodes.has(parentCode)) {
|
||||||
|
rootNodes.push(node);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 递归计算每个根节点的data
|
||||||
|
rootNodes.forEach((root) => computeData(root));
|
||||||
|
|
||||||
|
console.log(rootNodes)
|
||||||
|
return rootNodes;
|
||||||
|
// console.log('rootNodes', rootNodes);
|
||||||
|
// // 转换为目标格式
|
||||||
|
// function formatTree(node) {
|
||||||
|
// // console.log(node);
|
||||||
|
// return {
|
||||||
|
// orgCode: node.orgCode,
|
||||||
|
// name: node.name,
|
||||||
|
// type: 'bar',
|
||||||
|
// data: node.data,
|
||||||
|
// children: node.children.map((child) => formatTree(child))
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return rootNodes.map((root) => {
|
||||||
|
// console.log(root);
|
||||||
|
// formatTree(root);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//根据 orgCode 的分级格式,递归地汇总本级及其所有下级的数据,并将下级数据放在本级的 children 属性中。 deepseek
|
||||||
|
|
||||||
|
const groupByOrgCode = (orgCode, data) => {
|
||||||
|
// 过滤出本级和所有下级的数据
|
||||||
|
console.log("aaaa")
|
||||||
|
const filteredData = data.filter((item) => item.orgCode.startsWith(orgCode));
|
||||||
|
const orgMapper = new OrgCodeMapper(data);
|
||||||
|
// 如果过滤后的数据为空,返回 null
|
||||||
|
if (filteredData.length === 0) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '过滤后数据为空',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// console.log(0, filteredData);
|
||||||
|
// 按照 fieldValue 分组
|
||||||
|
const groupedByFieldValue = {};
|
||||||
|
try {
|
||||||
|
filteredData.forEach((item) => {
|
||||||
|
// console.log(item);
|
||||||
|
if (!groupedByFieldValue[item.fieldValue]) {
|
||||||
|
groupedByFieldValue[item.fieldValue] = {
|
||||||
|
orgCode: item.orgCode,
|
||||||
|
orgText: item.orgText,
|
||||||
|
fieldText: item.fieldText,
|
||||||
|
number: 0,
|
||||||
|
ldhth: []
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// console.log(item.orgCode, 22, groupedByFieldValue[item.fieldValue]);
|
||||||
|
groupedByFieldValue[item.fieldValue].number += item.number;
|
||||||
|
groupedByFieldValue[item.fieldValue].ldhth.push(...item.ldhth.split(','));
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
// console.log(1, orgMapper.findOrgText(orgCode));
|
||||||
|
// 构建本级结果
|
||||||
|
console.log("aaaa")
|
||||||
|
const result = {
|
||||||
|
orgCode: orgCode,
|
||||||
|
orgText: orgMapper.findOrgText(orgCode),
|
||||||
|
fieldValues: Object.keys(groupedByFieldValue).map((fieldValue) => {
|
||||||
|
const {
|
||||||
|
fieldText,
|
||||||
|
orgCode,
|
||||||
|
orgText
|
||||||
|
} = groupedByFieldValue[fieldValue] || {};
|
||||||
|
return {
|
||||||
|
fieldValue: fieldValue,
|
||||||
|
fieldText: fieldText,
|
||||||
|
orgCode: orgCode,
|
||||||
|
orgText: orgText,
|
||||||
|
number: groupedByFieldValue[fieldValue].number,
|
||||||
|
ldhth: [...new Set(groupedByFieldValue[fieldValue].ldhth)] // 去重
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
children: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// console.log('本级', result);
|
||||||
|
|
||||||
|
// 获取所有下一级的 orgCode
|
||||||
|
const nextLevelOrgCodes = new Set();
|
||||||
|
try {
|
||||||
|
filteredData.forEach((item) => {
|
||||||
|
if (item.orgCode !== orgCode && item.orgCode.startsWith(orgCode)) {
|
||||||
|
const nextLevelOrgCode = item.orgCode.substring(0, orgCode.length + 3);
|
||||||
|
nextLevelOrgCodes.add(nextLevelOrgCode);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
// 递归处理下一级数据
|
||||||
|
try {
|
||||||
|
nextLevelOrgCodes.forEach((nextLevelOrgCode) => {
|
||||||
|
const child = groupByOrgCode(nextLevelOrgCode, data);
|
||||||
|
if (child) {
|
||||||
|
result.children.push(child);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('全部', result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
// 获取统计数据 then filter
|
||||||
|
const fetchStatisticsData = async () => {
|
||||||
|
console.log(selectedOrgCode)
|
||||||
|
if (!selectedOrgCode.value || !selectedField.value) return;
|
||||||
|
let res = [];
|
||||||
|
chartData.value = [];
|
||||||
|
try {
|
||||||
|
//这里添加一个层级字段,并避免 厂机关A01A01A01 orgType by 闵
|
||||||
|
var tempOrgType = '1';
|
||||||
|
if(selectedOrgCode.value.includes('A01A01A01')){
|
||||||
|
tempOrgType = '1';
|
||||||
|
}else{
|
||||||
|
tempOrgType = orgType
|
||||||
|
}
|
||||||
|
if (selectedField.value === 'zjmc') {
|
||||||
|
console.log(dictCode.value);
|
||||||
|
console.log(dictData.value);
|
||||||
|
res = await cxcRyDatAstatisticsCertificate({
|
||||||
|
orgCode: selectedOrgCode.value,
|
||||||
|
field: selectedField.value,
|
||||||
|
dictCode: dictCode.value,
|
||||||
|
fieldisDict: fieldisDict.value,
|
||||||
|
typeOfWorkList: dictData.value,
|
||||||
|
orgType: tempOrgType.value
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
res = await cxcRyDatAstatistics({
|
||||||
|
orgCode: selectedOrgCode.value,
|
||||||
|
field: selectedField.value,
|
||||||
|
dictCode: dictCode.value,
|
||||||
|
fieldisDict: fieldisDict.value,
|
||||||
|
orgType: tempOrgType.value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log(res); //deepseek
|
||||||
|
if (res.success) {
|
||||||
|
console.log(selectedOrgCode.value, res);
|
||||||
|
if (res.result.length < 1) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '查询数据为空'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//按单位进行分组
|
||||||
|
orgCodeGroupData.value = groupByOrgCode(selectedOrgCode.value, res.result);
|
||||||
|
console.log(orgCodeGroupData.value);
|
||||||
|
//将数据转换成echart格式
|
||||||
|
const temp = transformData(selectedOrgCode.value, res.result);
|
||||||
|
|
||||||
|
if (temp[0].children.length > 0) {
|
||||||
|
chartData.value = JSON.parse(JSON.stringify(temp[0].children));
|
||||||
|
|
||||||
|
chartDataCount.value = chartData.value.length;
|
||||||
|
console.log(chartData.value);
|
||||||
|
// updateChart(chartData.value);
|
||||||
|
} else {
|
||||||
|
var tempArr = [];
|
||||||
|
tempArr.push(temp[0])
|
||||||
|
chartData.value =tempArr;
|
||||||
|
}
|
||||||
|
updateChart(chartData.value);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取统计数据失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取人员列表 delimiter
|
||||||
|
const fetchPersonnelList = async (ldhthList) => {
|
||||||
|
personnelList.value = [];
|
||||||
|
try {
|
||||||
|
const res = await cxcRyDatAstatisticsDetails({
|
||||||
|
ldhth: ldhthList
|
||||||
|
});
|
||||||
|
console.log(res);
|
||||||
|
if (res.success) {
|
||||||
|
personnelList.value = res.result;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('获取人员列表失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 事件处理
|
||||||
|
const onOrgCodeChange = (e, data) => {
|
||||||
|
personnelList.value = [];
|
||||||
|
selectedOrgCode.value = e;
|
||||||
|
console.log(e)
|
||||||
|
console.log(data);
|
||||||
|
orgType.value = data.value.orgType; //赋值层级 by 闵
|
||||||
|
selectedOrgCodeLabel.value = data.value.title;
|
||||||
|
fetchStatisticsData();
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFieldChange = (e) => {
|
||||||
|
|
||||||
|
personnelList.value = [];
|
||||||
|
// console.log(e);
|
||||||
|
try {
|
||||||
|
selectedField.value = e;
|
||||||
|
for (var index = 0; index < fieldList.value.length; index++) {
|
||||||
|
var element = fieldList.value[index];
|
||||||
|
// console.log(element);
|
||||||
|
if (element.value === e) {
|
||||||
|
selectedFieldLabel.value = element.text;
|
||||||
|
dictCode.value = element.dictCode;
|
||||||
|
fieldisDict.value = element.isDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (selectedField.value === 'zjmc') {
|
||||||
|
showPopup.value.open()
|
||||||
|
} else {
|
||||||
|
fetchStatisticsData();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
//TODO handle the exception
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChartClick = (e) => {
|
||||||
|
personnelList.value = [];
|
||||||
|
const {
|
||||||
|
ldhth
|
||||||
|
} = chartData.value;
|
||||||
|
if (ldhth && ldhth.length > 0) {
|
||||||
|
fetchPersonnelList(ldhth);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped>
|
||||||
|
/* 颜色变量 */
|
||||||
|
:root {
|
||||||
|
--primary-blue: #409eff;
|
||||||
|
--deep-blue: #2c7be5;
|
||||||
|
--light-blue: #ecf5ff;
|
||||||
|
--gradient-start: #6b8cff;
|
||||||
|
--gradient-end: #4364f7;
|
||||||
|
--hover-blue: #66b1ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 全局容器 */
|
||||||
|
.container {
|
||||||
|
margin: 10px 10px;
|
||||||
|
padding: 10px;
|
||||||
|
background: linear-gradient(145deg, #f5f9ff, var(--light-blue));
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
|
||||||
|
border: 1px solid rgba(64, 158, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 图表容器 */
|
||||||
|
.chart-container {
|
||||||
|
height: 250px;
|
||||||
|
margin: 10px 0;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #ffffff;
|
||||||
|
box-shadow: 0 4px 16px rgba(64, 158, 255, 0.12);
|
||||||
|
border: 1px solid rgba(64, 158, 255, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 表格标题行 */
|
||||||
|
|
||||||
|
.titleStyle {
|
||||||
|
font-size: 10px;
|
||||||
|
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 {
|
||||||
|
font-size: 10px;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 内容样式 */
|
||||||
|
.dataStyle1 {
|
||||||
|
font-size: 8px;
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 滚动区域 */
|
||||||
|
scroll-view {
|
||||||
|
background: #ffffff;
|
||||||
|
border-radius: 0 0 8px 8px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0, 35, 111, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输入框聚焦效果 */
|
||||||
|
.trq-depart-select:focus-within {
|
||||||
|
box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
|
||||||
|
border-color: var(--primary-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 加载动画优化 */
|
||||||
|
@keyframes fadeIn {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.container>* {
|
||||||
|
animation: fadeIn 0.6s cubic-bezier(0.23, 1, 0.32, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 自定义滚动条美化 */
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 4px;
|
||||||
|
background: rgba(64, 158, 255, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background: linear-gradient(45deg, var(--primary-blue), var(--deep-blue));
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 筛选行间距优化 */
|
||||||
|
.filter-row {
|
||||||
|
margin: 15px 0;
|
||||||
|
padding: 10px 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 响应式调整优化 */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.chart-container {
|
||||||
|
height: 250px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 数据行高亮效果 */
|
||||||
|
.data-row:nth-child(even) {
|
||||||
|
background: rgba(236, 245, 255, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-row:hover {
|
||||||
|
box-shadow: 0 4rpx 12rpx rgba(64, 158, 255, 0.1);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,54 +1,98 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="container" id="top1">
|
||||||
<scroll-view :scroll-y="true" style="height: 100vh;">
|
<uni-card>
|
||||||
<uni-card>
|
<view>
|
||||||
<view>
|
<uni-row>
|
||||||
<uni-row>
|
<uni-col :span="11"><uni-title title="姓名 " align="left" type="h5"></uni-title></uni-col>
|
||||||
<uni-col :span="11"><uni-title title="姓名 " align="left" type="h5"></uni-title></uni-col>
|
<uni-col :span="11" :push="2"><uni-title title="劳动合同号" align="left" type="h5"></uni-title></uni-col>
|
||||||
<uni-col :span="11" :push="2"><uni-title title="劳动合同号" align="left"
|
</uni-row>
|
||||||
type="h5"></uni-title></uni-col>
|
<uni-row>
|
||||||
</uni-row>
|
<uni-col :span="11"><uni-easyinput v-model="xm" suffixIcon="search" clearable placeholder="姓名模糊查询"
|
||||||
<uni-row>
|
@change="Search" @iconClick="Search" /></uni-col>
|
||||||
<uni-col :span="11"><uni-easyinput v-model="xm" suffixIcon="search" clearable
|
<uni-col :span="11" :push="2">
|
||||||
placeholder="姓名模糊查询" @change="Search" @iconClick="Search" /></uni-col>
|
<uni-easyinput v-model="ldhth" suffixIcon="search" clearable placeholder="劳动合同号模糊查询"
|
||||||
<uni-col :span="11" :push="2">
|
@change="Search" @iconClick="Search" />
|
||||||
<uni-easyinput v-model="ldhth" suffixIcon="search" clearable placeholder="劳动合同号模糊查询"
|
</uni-col>
|
||||||
@change="Search" @iconClick="Search" />
|
</uni-row>
|
||||||
</uni-col>
|
</view>
|
||||||
</uni-row>
|
<view style="margin-bottom: 10rpx">
|
||||||
</view>
|
<uni-row>
|
||||||
<view style="margin-bottom: 10rpx;">
|
<uni-col :span="24"><uni-title title="所属单位" align="left" type="h5"></uni-title></uni-col>
|
||||||
<uni-row>
|
</uni-row>
|
||||||
<uni-col :span="24"><uni-title title="所属单位" align="left" type="h5"></uni-title></uni-col>
|
<uni-row>
|
||||||
</uni-row>
|
<uni-col :span="24">
|
||||||
<uni-row>
|
<trq-depart-select v-model="departID" returnCodeOrID="orgCode"
|
||||||
<uni-col :span="24">
|
@change="departChange"></trq-depart-select>
|
||||||
<trq-depart-select v-model="departID" returnCodeOrID="orgCode"
|
</uni-col>
|
||||||
@change="departChange"></trq-depart-select>
|
</uni-row>
|
||||||
</uni-col>
|
</view>
|
||||||
</uni-row>
|
</uni-card>
|
||||||
</view>
|
|
||||||
</uni-card>
|
|
||||||
<uni-card>
|
|
||||||
<zb-table :show-header="true" :highlight="true" :columns="column" :stripe="true" :fit="false"
|
|
||||||
:border="true" :data="ryDataList" @detail="detail"></zb-table>
|
|
||||||
<uni-pagination :current="current" :pagerCount="pages" :total="total" prev-text="前一页" next-text="后一页"
|
|
||||||
:show-icon="false" @change="pagechange" />
|
|
||||||
<view>
|
|
||||||
<text class="example-info">当前页:{{ current }},数据总量:{{ total }}条,每页数据:{{ pageSize }}</text>
|
|
||||||
</view>
|
|
||||||
</uni-card>
|
|
||||||
</scroll-view>
|
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
<uni-card>
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
|
||||||
|
<uni-row>
|
||||||
|
<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 v-if="ryDataList.length > 0">
|
||||||
|
<view v-for="(item, index) in ryDataList">
|
||||||
|
<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">
|
||||||
|
<span @click="detail(item)" style="color: red;">详情</span>
|
||||||
|
<!-- <button size="mini" type="primary" @click="detail(item)">详情</button> -->
|
||||||
|
</view>
|
||||||
|
</uni-col>
|
||||||
|
</view>
|
||||||
|
</uni-row>
|
||||||
|
|
||||||
|
<view class="pagination">
|
||||||
|
<uni-pagination :current="current" :pagerCount="5" :total="total" prev-text="前一页" next-text="后一页"
|
||||||
|
:show-icon="false" @change="pagechange" />
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</uni-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
onReady,
|
onReady,
|
||||||
onLoad
|
onLoad
|
||||||
|
|
||||||
} from '@dcloudio/uni-app';
|
} from '@dcloudio/uni-app';
|
||||||
import {
|
import {
|
||||||
reactive,
|
reactive,
|
||||||
@ -61,135 +105,130 @@
|
|||||||
import {
|
import {
|
||||||
queryDepByCode,
|
queryDepByCode,
|
||||||
queryZbDepByLdhth
|
queryZbDepByLdhth
|
||||||
} from '@/api/depart.js'
|
} from '@/api/depart.js';
|
||||||
import {
|
import {
|
||||||
queryRenyuanByDepartID
|
queryRenyuanByDepartID
|
||||||
} from '@/api/renyuan.js'
|
} from '@/api/renyuan.js';
|
||||||
let xm = ref("")
|
let xm = ref('');
|
||||||
let ldhth = ref("")
|
let ldhth = ref('');
|
||||||
let departID = ref("") //部门树选中的ID
|
let departID = ref(''); //部门树选中的ID
|
||||||
const ryDataList = ref([])
|
const ryDataList = ref([]);
|
||||||
|
|
||||||
let status = ref("")
|
const bottomHeight = ref(0);
|
||||||
|
let status = ref('');
|
||||||
let contentText = reactive({
|
let contentText = reactive({
|
||||||
contentdown: '点击查看更多',
|
contentdown: '点击查看更多',
|
||||||
contentrefresh: '加载中',
|
contentrefresh: '加载中',
|
||||||
contentnomore: '没有更多'
|
contentnomore: '没有更多'
|
||||||
})
|
});
|
||||||
|
|
||||||
let pageNo = ref(1)
|
let pageNo = ref(1);
|
||||||
let pageSize = ref(10)
|
let pageSize = ref(10);
|
||||||
let total = ref(0)
|
let total = ref(0);
|
||||||
let pages = ref(0)
|
let pages = ref(0);
|
||||||
let current = ref(0)
|
let current = ref(0);
|
||||||
let params = reactive({
|
let params = reactive({
|
||||||
pageNo: pageNo,
|
pageNo: pageNo,
|
||||||
pageSize: pageSize
|
pageSize: pageSize
|
||||||
})
|
});
|
||||||
let column = ref([{
|
|
||||||
label: '序号',
|
|
||||||
width: 60,
|
|
||||||
type: 'index',
|
|
||||||
color: 'blue',
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
onLoad((e) => {});
|
||||||
name: 'xm',
|
|
||||||
label: '姓名',
|
|
||||||
width: 70,
|
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'xb_dictText',
|
|
||||||
label: '性别',
|
|
||||||
align: 'center',
|
|
||||||
width: 60
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'nl',
|
|
||||||
label: '年龄',
|
|
||||||
align: 'center',
|
|
||||||
width: 60
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'operation',
|
|
||||||
type: 'operation',
|
|
||||||
width: 60,
|
|
||||||
fixed: true,
|
|
||||||
label: '操作',
|
|
||||||
align: 'center',
|
|
||||||
renders: [{
|
|
||||||
name: '详情',
|
|
||||||
func: 'detail',
|
|
||||||
size: 'mini'
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
])
|
|
||||||
|
|
||||||
onLoad((e) => {
|
|
||||||
|
|
||||||
})
|
|
||||||
onMounted((e) => {
|
onMounted((e) => {
|
||||||
departID.value = ""
|
|
||||||
getRenyuanByDepID()
|
getHeight();
|
||||||
})
|
departID.value = '';
|
||||||
|
getRenyuanByDepID();
|
||||||
|
});
|
||||||
|
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;
|
||||||
|
})
|
||||||
|
.exec();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
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))
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function pagechange(e) {
|
function pagechange(e) {
|
||||||
current.value = e.current
|
current.value = e.current;
|
||||||
pageNo.value = e.current
|
pageNo.value = e.current;
|
||||||
let params = {
|
let params = {
|
||||||
pageNo: pageNo.value,
|
pageNo: pageNo.value,
|
||||||
pageSize: pageSize.value,
|
pageSize: pageSize.value,
|
||||||
current: current.value
|
current: current.value
|
||||||
};
|
};
|
||||||
if (departID.value.length <= 9) {
|
if (departID.value.length <= 9) {
|
||||||
params.orgCode = departID.value
|
params.orgCode = departID.value;
|
||||||
} else {
|
} else {
|
||||||
params.jcxd_code = departID.value
|
params.jcxd_code = departID.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRenyuanByDepID(params)
|
getRenyuanByDepID(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
function departChange(e, data) {
|
function departChange(e, data) {
|
||||||
departID.value = e
|
departID.value = e;
|
||||||
let params = {
|
let params = {
|
||||||
pageNo: pageNo.value,
|
pageNo: pageNo.value,
|
||||||
pageSize: pageSize.value,
|
pageSize: pageSize.value,
|
||||||
current: current.value
|
current: current.value
|
||||||
};
|
};
|
||||||
console.log(e)
|
console.log(e);
|
||||||
if (e.length <= 9) {
|
if (e.length <= 9) {
|
||||||
params.orgCode = departID.value
|
params.orgCode = departID.value;
|
||||||
} else {
|
} else {
|
||||||
params.jcxd_code = departID.value
|
params.jcxd_code = departID.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
getRenyuanByDepID(params)
|
getRenyuanByDepID(params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRenyuanByDepID(queryParm) {
|
function getRenyuanByDepID(queryParm) {
|
||||||
ryDataList.value = []
|
// ryDataList.value = [];
|
||||||
console.log(queryParm)
|
console.log(queryParm);
|
||||||
queryRenyuanByDepartID(queryParm).then((res) => {
|
if (departID.value.length <= 6) {
|
||||||
console.log(res)
|
console.log(123242353);
|
||||||
if (res.success) {
|
uni.showToast({
|
||||||
ryDataList.value = res.result.records
|
title: '全厂数据较多,请选 下一层级...',
|
||||||
total.value = res.result.total
|
icon: 'none',
|
||||||
pages.value = res.result.pages
|
duration: 1000
|
||||||
current.value = res.result.current
|
});
|
||||||
}
|
|
||||||
}).catch((err) => {
|
return;
|
||||||
console.log(err);
|
}
|
||||||
})
|
if (queryParm) {
|
||||||
|
queryRenyuanByDepartID(queryParm)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
if (res.success) {
|
||||||
|
ryDataList.value = res.result.records;
|
||||||
|
total.value = res.result.total;
|
||||||
|
pages.value = res.result.pages;
|
||||||
|
current.value = res.result.current;
|
||||||
|
}
|
||||||
|
getHeight();
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Search() {
|
function Search() {
|
||||||
@ -207,22 +246,72 @@
|
|||||||
if (ldhth.value !== '') {
|
if (ldhth.value !== '') {
|
||||||
queryParm.ldhth = '*' + ldhth.value + '*';
|
queryParm.ldhth = '*' + ldhth.value + '*';
|
||||||
}
|
}
|
||||||
console.log(queryParm)
|
console.log(queryParm);
|
||||||
queryRenyuanByDepartID(queryParm).then((res) => {
|
queryRenyuanByDepartID(queryParm)
|
||||||
if (res.success) {
|
.then((res) => {
|
||||||
ryDataList.value = res.result.records
|
if (res.success) {
|
||||||
total.value = res.result.total
|
ryDataList.value = res.result.records;
|
||||||
pages.value = res.result.pages
|
total.value = res.result.total;
|
||||||
}
|
pages.value = res.result.pages;
|
||||||
}).catch((err) => {
|
}
|
||||||
console.log(err);
|
})
|
||||||
})
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
/* 全局容器 */
|
||||||
|
.container {
|
||||||
|
/* margin: 10rpx 10rpx; */
|
||||||
|
/* padding: 10rpx; */
|
||||||
|
background: linear-gradient(145deg, #ffaaff, var(--light-blue));
|
||||||
|
border-radius: 24rpx;
|
||||||
|
box-shadow: 0 8rpx 24rpx rgba(64, 158, 255, 0.15);
|
||||||
|
border: 2rpx solid rgba(64, 158, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
.uni-group {
|
.uni-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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 {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 内容样式 */
|
||||||
|
.pagination {
|
||||||
|
font-size: 16px;
|
||||||
|
color: #00007f;
|
||||||
|
line-height: 30px;
|
||||||
|
height: 30px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -1,10 +1,10 @@
|
|||||||
<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="'所选单位'" 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"
|
<trq-depart-select v-model="orgCode" returnCodeOrID="orgCode"
|
||||||
@change="departChange"></trq-depart-select>
|
@change="departChange"></trq-depart-select>
|
||||||
@ -12,7 +12,7 @@
|
|||||||
</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>
|
||||||
@ -27,68 +27,57 @@
|
|||||||
<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 class="titleStyle">序号</view>
|
||||||
序号
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="5">
|
<uni-col :span="5">
|
||||||
<view class="titleStyle">
|
<view class="titleStyle">姓名</view>
|
||||||
姓名
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="5">
|
<uni-col :span="5">
|
||||||
<view class="titleStyle">
|
<view class="titleStyle">性别</view>
|
||||||
性别
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="5">
|
<uni-col :span="5">
|
||||||
<view class="titleStyle">
|
<view class="titleStyle">年龄</view>
|
||||||
年龄
|
|
||||||
</view>
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="6">
|
<uni-col :span="6">
|
||||||
<view class="titleStyle">
|
<view class="titleStyle">操作</view>
|
||||||
操作
|
|
||||||
</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 :span="5">
|
</uni-col>
|
||||||
|
<uni-col :span="5">
|
||||||
<view class="dataStyle">
|
<view class="dataStyle">
|
||||||
{{item.xb_dictText}}
|
{{ item.xb_dictText }}
|
||||||
</view>
|
</view>
|
||||||
</uni-col><uni-col :span="5">
|
</uni-col>
|
||||||
|
<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">
|
||||||
<view class="dataStyle">
|
<view class="dataStyle">
|
||||||
<button size="mini" type="primary" @click="detail(item)">详情</button>
|
<span @click="detail(item)" style="color: red;">详情</span>
|
||||||
|
<!-- <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>
|
||||||
@ -99,11 +88,11 @@
|
|||||||
reactive,
|
reactive,
|
||||||
onMounted
|
onMounted
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
import * as echarts from 'echarts'
|
import * as echarts from 'echarts';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
queryRenyuanByDepartID
|
queryRenyuanByDepartID
|
||||||
} from '@/api/renyuan.js'
|
} from '@/api/renyuan.js';
|
||||||
|
|
||||||
// 存储下方组件的高度
|
// 存储下方组件的高度
|
||||||
const bottomHeight = ref(0);
|
const bottomHeight = ref(0);
|
||||||
@ -125,8 +114,8 @@
|
|||||||
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) => {
|
||||||
@ -141,21 +130,22 @@
|
|||||||
};
|
};
|
||||||
// 加载数据
|
// 加载数据
|
||||||
const departChange = async (e, data) => {
|
const departChange = async (e, data) => {
|
||||||
|
tableData.value = [];
|
||||||
tableData.value = []
|
console.log(e);
|
||||||
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.showToast({
|
||||||
uni.showLoading({
|
title: '全厂数据较多,请选 下一层级...',
|
||||||
title: '全厂数据较多,耐心等待数据加载中...',
|
icon: 'none',
|
||||||
mask: true
|
duration: 1000
|
||||||
});
|
});
|
||||||
|
isLoading.value = false;
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '数据加载中...',
|
title: '数据加载中...',
|
||||||
@ -168,34 +158,34 @@
|
|||||||
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).then((res) => {
|
queryRenyuanByDepartID(params)
|
||||||
if (res.success) {
|
.then((res) => {
|
||||||
processData(res.result.records);
|
if (res.success) {
|
||||||
|
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',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
});
|
});
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error);
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '数据加载失败',
|
title: '数据加载失败',
|
||||||
icon: 'none'
|
icon: 'none',
|
||||||
|
duration: 1000
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
// 隐藏加载状态
|
// 隐藏加载状态
|
||||||
@ -204,15 +194,15 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// 数据处理
|
// 数据处理
|
||||||
const processData = (data) => {
|
const processData = (data) => {
|
||||||
|
|
||||||
// 添加年龄字段并过滤有效数据
|
// 添加年龄字段并过滤有效数据
|
||||||
const validData = data.map(item => ({
|
const validData = data
|
||||||
...item,
|
.map((item) => ({
|
||||||
nl: calculateAge(item.cssj)
|
...item,
|
||||||
})).filter(item => item.nl >= 21 && item.nl <= 64);
|
nl: calculateAge(item.cssj)
|
||||||
|
}))
|
||||||
|
.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;
|
||||||
@ -222,27 +212,25 @@
|
|||||||
groupsData(validData);
|
groupsData(validData);
|
||||||
// 生成图表数据
|
// 生成图表数据
|
||||||
generateChartData(validData);
|
generateChartData(validData);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 计算统计信息...
|
// 计算统计信息...
|
||||||
const subOrgStaffs = ref({}); // 按下级单位存储所有人员
|
const subOrgStaffs = ref({}); // 按下级单位存储所有人员
|
||||||
const ageGroupStaffs = ref({}); // 按年龄段存储所有人员
|
const ageGroupStaffs = ref({}); // 按年龄段存储所有人员
|
||||||
|
|
||||||
|
|
||||||
const groupsData = (data) => {
|
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
|
||||||
@ -256,9 +244,8 @@
|
|||||||
ageGroupStaffs.value[ageRange] = [];
|
ageGroupStaffs.value[ageRange] = [];
|
||||||
}
|
}
|
||||||
ageGroupStaffs.value[ageRange].push(cur);
|
ageGroupStaffs.value[ageRange].push(cur);
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
// 新增年龄范围计算方法
|
// 新增年龄范围计算方法
|
||||||
const getAgeRange = (age) => {
|
const getAgeRange = (age) => {
|
||||||
@ -270,9 +257,7 @@
|
|||||||
// 修改后的显示人员列表方法
|
// 修改后的显示人员列表方法
|
||||||
const showStaffList = (subOrg, ageRange) => {
|
const showStaffList = (subOrg, ageRange) => {
|
||||||
// 从结构化数据中直接获取
|
// 从结构化数据中直接获取
|
||||||
const targetStaffs = subOrgStaffs.value[subOrg].filter(staff =>
|
const targetStaffs = subOrgStaffs.value[subOrg].filter((staff) => getAgeRange(staff.nl) === ageRange);
|
||||||
getAgeRange(staff.nl) === ageRange
|
|
||||||
);
|
|
||||||
|
|
||||||
staffList.value = targetStaffs;
|
staffList.value = targetStaffs;
|
||||||
popupTitle.value = `${subOrg} ${ageRange}人员列表(共${targetStaffs.length}人)`;
|
popupTitle.value = `${subOrg} ${ageRange}人员列表(共${targetStaffs.length}人)`;
|
||||||
@ -307,14 +292,13 @@
|
|||||||
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]
|
||||||
},
|
},
|
||||||
@ -322,14 +306,14 @@
|
|||||||
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],
|
||||||
@ -377,7 +361,7 @@
|
|||||||
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: {
|
||||||
@ -413,35 +397,30 @@
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
|
|
||||||
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 = () => {
|
||||||
@ -455,7 +434,7 @@
|
|||||||
.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;
|
||||||
})
|
})
|
||||||
@ -466,10 +445,10 @@
|
|||||||
// 初始化图表
|
// 初始化图表
|
||||||
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>
|
||||||
|
|
||||||
@ -492,7 +471,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.query-btn {
|
.query-btn {
|
||||||
background: #007AFF;
|
background: #007aff;
|
||||||
color: white;
|
color: white;
|
||||||
padding: 0 40rpx;
|
padding: 0 40rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
@ -534,12 +513,11 @@
|
|||||||
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;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 内容样式 */
|
/* 内容样式 */
|
||||||
@ -558,6 +536,5 @@
|
|||||||
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>
|
||||||
0
uni_modules/cxc-szcx-dictSelect/changelog.md
Normal file
0
uni_modules/cxc-szcx-dictSelect/changelog.md
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<uni-data-checkbox v-model="selectedValuesArray" :localdata="dictItems" :multiple="true" data-key="value"
|
||||||
|
data-value="label"></uni-data-checkbox>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import {
|
||||||
|
ref,
|
||||||
|
onMounted,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
getDictItemsApi
|
||||||
|
} from '@/api/api.js';
|
||||||
|
|
||||||
|
// 定义 props 和 emits
|
||||||
|
const props = defineProps({
|
||||||
|
dictCode: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
modelValue: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(['update:modelValue', 'change']);
|
||||||
|
|
||||||
|
// 定义数据
|
||||||
|
const dictItems = ref([]);
|
||||||
|
const selectedValuesArray = ref(props.modelValue ? props.modelValue.split(',') : []);
|
||||||
|
|
||||||
|
// 加载字典数据
|
||||||
|
const loadDictItems = async () => {
|
||||||
|
try {
|
||||||
|
const response = await getDictItemsApi(props.dictCode);
|
||||||
|
dictItems.value = response.result; // 假设响应数据的格式为 { data: [...] }
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载字典数据失败:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 监听选中值的变化并通知父组件
|
||||||
|
watch(selectedValuesArray, (newValue) => {
|
||||||
|
console.log('selectedValuesArray 变化:', newValue);
|
||||||
|
const selectedValuesString = newValue.join(',');
|
||||||
|
emits('update:modelValue', selectedValuesString);
|
||||||
|
emits('change', selectedValuesString);
|
||||||
|
}, {
|
||||||
|
deep: true
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听 props.modelValue 的变化
|
||||||
|
watch(() => props.modelValue, (newValue) => {
|
||||||
|
console.log('props.modelValue 变化:', newValue);
|
||||||
|
selectedValuesArray.value = newValue ? newValue.split(',') : [];
|
||||||
|
}, {
|
||||||
|
immediate: true
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
loadDictItems();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
/* 可以添加组件的样式 */
|
||||||
|
</style>
|
||||||
83
uni_modules/cxc-szcx-dictSelect/package.json
Normal file
83
uni_modules/cxc-szcx-dictSelect/package.json
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
{
|
||||||
|
"id": "cxc-szcx-dictSelect",
|
||||||
|
"displayName": "cxc-szcx-dictSelect",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "cxc-szcx-dictSelect",
|
||||||
|
"keywords": [
|
||||||
|
"cxc-szcx-dictSelect"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": "^3.1.0"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"type": "component-vue",
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "",
|
||||||
|
"data": "",
|
||||||
|
"permissions": ""
|
||||||
|
},
|
||||||
|
"npmurl": ""
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "u",
|
||||||
|
"aliyun": "u",
|
||||||
|
"alipay": "u"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "u",
|
||||||
|
"vue3": "u"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-vue": "u",
|
||||||
|
"app-nvue": "u",
|
||||||
|
"app-uvue": "u"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "u",
|
||||||
|
"Android Browser": "u",
|
||||||
|
"微信浏览器(Android)": "u",
|
||||||
|
"QQ浏览器(Android)": "u"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "u",
|
||||||
|
"IE": "u",
|
||||||
|
"Edge": "u",
|
||||||
|
"Firefox": "u",
|
||||||
|
"Safari": "u"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "u",
|
||||||
|
"阿里": "u",
|
||||||
|
"百度": "u",
|
||||||
|
"字节跳动": "u",
|
||||||
|
"QQ": "u",
|
||||||
|
"钉钉": "u",
|
||||||
|
"快手": "u",
|
||||||
|
"飞书": "u",
|
||||||
|
"京东": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
uni_modules/cxc-szcx-dictSelect/readme.md
Normal file
1
uni_modules/cxc-szcx-dictSelect/readme.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# cxc-szcx-dictSelect
|
||||||
@ -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)
|
||||||
}
|
}
|
||||||
this.tick!()
|
if(this.tick != null) {
|
||||||
|
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;
|
||||||
|
|||||||
3888
uni_modules/lime-shared/areaData/city-china.json
Normal file
3888
uni_modules/lime-shared/areaData/city-china.json
Normal file
File diff suppressed because it is too large
Load Diff
71
uni_modules/lime-shared/areaData/index.ts
Normal file
71
uni_modules/lime-shared/areaData/index.ts
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import _areaList from './city-china.json';
|
||||||
|
export const areaList = _areaList
|
||||||
|
// #ifndef UNI-APP-X
|
||||||
|
type UTSJSONObject = Record<string, string>
|
||||||
|
// #endif
|
||||||
|
// #ifdef UNI-APP-X
|
||||||
|
type Object = UTSJSONObject
|
||||||
|
// #endif
|
||||||
|
type AreaList = {
|
||||||
|
province_list : Map<string, string>;
|
||||||
|
city_list : Map<string, string>;
|
||||||
|
county_list : Map<string, string>;
|
||||||
|
}
|
||||||
|
// type CascaderOption = {
|
||||||
|
// text : string;
|
||||||
|
// value : string;
|
||||||
|
// children ?: CascaderOption[];
|
||||||
|
// };
|
||||||
|
|
||||||
|
const makeOption = (
|
||||||
|
label : string,
|
||||||
|
value : string,
|
||||||
|
children ?: UTSJSONObject[],
|
||||||
|
) : UTSJSONObject => ({
|
||||||
|
label,
|
||||||
|
value,
|
||||||
|
children,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
export function useCascaderAreaData() : UTSJSONObject[] {
|
||||||
|
const city = areaList['city_list'] as UTSJSONObject
|
||||||
|
const county = areaList['county_list'] as UTSJSONObject
|
||||||
|
const province = areaList['province_list'] as UTSJSONObject
|
||||||
|
const provinceMap = new Map<string, UTSJSONObject>();
|
||||||
|
Object.keys(province).forEach((code) => {
|
||||||
|
provinceMap.set(code.slice(0, 2), makeOption(`${province[code]}`, code, []));
|
||||||
|
});
|
||||||
|
|
||||||
|
const cityMap = new Map<string, UTSJSONObject>();
|
||||||
|
|
||||||
|
Object.keys(city).forEach((code) => {
|
||||||
|
const option = makeOption(`${city[code]}`, code, []);
|
||||||
|
cityMap.set(code.slice(0, 4), option);
|
||||||
|
|
||||||
|
const _province = provinceMap.get(code.slice(0, 2));
|
||||||
|
if (_province != null) {
|
||||||
|
(_province['children'] as UTSJSONObject[]).push(option)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.keys(county).forEach((code) => {
|
||||||
|
const _city = cityMap.get(code.slice(0, 4));
|
||||||
|
if (_city != null) {
|
||||||
|
(_city['children'] as UTSJSONObject[]).push(makeOption(`${county[code]}`, code, null));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// #ifndef APP-ANDROID || APP-IOS
|
||||||
|
return Array.from(provinceMap.values());
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-ANDROID || APP-IOS
|
||||||
|
const obj : UTSJSONObject[] = []
|
||||||
|
provinceMap.forEach((value, code) => {
|
||||||
|
obj.push(value)
|
||||||
|
})
|
||||||
|
return obj
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
@ -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
|
|
||||||
}
|
}
|
||||||
|
|||||||
111
uni_modules/lime-shared/capitalizedAmount/index.ts
Normal file
111
uni_modules/lime-shared/capitalizedAmount/index.ts
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { isString } from "../isString";
|
||||||
|
import { isNumber } from "../isNumber";
|
||||||
|
/**
|
||||||
|
* 将金额转换为中文大写形式
|
||||||
|
* @param {number | string} amount - 需要转换的金额,可以是数字或字符串
|
||||||
|
* @returns {string} 转换后的中文大写金额
|
||||||
|
*/
|
||||||
|
function capitalizedAmount(amount : number) : string
|
||||||
|
function capitalizedAmount(amount : string) : string
|
||||||
|
function capitalizedAmount(amount : any | null) : string {
|
||||||
|
try {
|
||||||
|
let _amountStr :string;
|
||||||
|
let _amountNum :number = 0;
|
||||||
|
// 如果输入是字符串,先将其转换为数字,并去除逗号
|
||||||
|
if (typeof amount == 'string') {
|
||||||
|
_amountNum = parseFloat((amount as string).replace(/,/g, ''));
|
||||||
|
}
|
||||||
|
if(isNumber(amount)) {
|
||||||
|
_amountNum = amount as number
|
||||||
|
}
|
||||||
|
// 判断输入是否为有效的金额 || isNaN(amount)
|
||||||
|
if (amount == null) throw new Error('不是有效的金额!');
|
||||||
|
|
||||||
|
let result = '';
|
||||||
|
|
||||||
|
// 处理负数情况
|
||||||
|
if (_amountNum < 0) {
|
||||||
|
result = '欠';
|
||||||
|
_amountNum = Math.abs(_amountNum);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 金额不能超过千亿以上
|
||||||
|
if (_amountNum >= 10e11) throw new Error('计算金额过大!');
|
||||||
|
|
||||||
|
// 保留两位小数并转换为字符串
|
||||||
|
_amountStr = _amountNum.toFixed(2);
|
||||||
|
|
||||||
|
// 定义数字、单位和小数单位的映射
|
||||||
|
const digits = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
|
||||||
|
const units = ['', '拾', '佰', '仟'];
|
||||||
|
const bigUnits = ['', '万', '亿'];
|
||||||
|
const decimalUnits = ['角', '分'];
|
||||||
|
|
||||||
|
// 分离整数部分和小数部分
|
||||||
|
const amountArray = _amountStr.split('.');
|
||||||
|
let integerPart = amountArray[0]; // string| number[]
|
||||||
|
const decimalPart = amountArray[1];
|
||||||
|
|
||||||
|
// 处理整数部分
|
||||||
|
if (integerPart != '0') {
|
||||||
|
let _integerPart = integerPart.split('').map((item):number => parseInt(item));
|
||||||
|
|
||||||
|
// 将整数部分按四位一级进行分组
|
||||||
|
const levels = _integerPart.reverse().reduce((prev:string[][], item, index):string[][] => {
|
||||||
|
// const level = prev?.[0]?.length < 4 ? prev[0] : [];
|
||||||
|
const level = prev.length > 0 && prev[0].length < 4 ? prev[0]: []
|
||||||
|
|
||||||
|
const value = item == 0 ? digits[item] : digits[item] + units[index % 4];
|
||||||
|
|
||||||
|
level.unshift(value);
|
||||||
|
|
||||||
|
if (level.length == 1) {
|
||||||
|
prev.unshift(level);
|
||||||
|
} else {
|
||||||
|
prev[0] = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
return prev;
|
||||||
|
}, [] as string[][]);
|
||||||
|
// 将分组后的整数部分转换为中文大写形式
|
||||||
|
result += levels.reduce((prev, item, index):string => {
|
||||||
|
let _level = bigUnits[levels.length - index - 1];
|
||||||
|
let _item = item.join('').replace(/(零)\1+/g, '$1');
|
||||||
|
|
||||||
|
if (_item == '零') {
|
||||||
|
_level = '';
|
||||||
|
_item = '';
|
||||||
|
} else if (_item.endsWith('零')) {
|
||||||
|
_item = _item.slice(0, _item.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return prev + _item + _level;
|
||||||
|
}, '');
|
||||||
|
} else {
|
||||||
|
result += '零';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加元
|
||||||
|
result += '元';
|
||||||
|
|
||||||
|
// 处理小数部分
|
||||||
|
if (decimalPart != '00') {
|
||||||
|
if (result == '零元') result = '';
|
||||||
|
|
||||||
|
for (let i = 0; i < decimalPart.length; i++) {
|
||||||
|
const digit = parseInt(decimalPart.charAt(i));
|
||||||
|
|
||||||
|
if (digit != 0) {
|
||||||
|
result += digits[digit] + decimalUnits[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
result += '整';
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
} catch (error : Error) {
|
||||||
|
return error.message;
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -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: 减少依赖
|
||||||
|
|||||||
63
uni_modules/lime-shared/characterLimit/index.ts
Normal file
63
uni_modules/lime-shared/characterLimit/index.ts
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* 计算字符串字符的长度并可以截取字符串。
|
||||||
|
* @param char 传入字符串(maxcharacter条件下,一个汉字表示两个字符)
|
||||||
|
* @param max 规定最大字符串长度
|
||||||
|
* @returns 当没有传入maxCharacter/maxLength 时返回字符串字符长度,当传入maxCharacter/maxLength时返回截取之后的字符串和长度。
|
||||||
|
*/
|
||||||
|
export type CharacterLengthResult = {
|
||||||
|
length : number;
|
||||||
|
characters : string;
|
||||||
|
}
|
||||||
|
// #ifdef APP-ANDROID
|
||||||
|
type ChartType = any
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-ANDROID
|
||||||
|
type ChartType = string | number
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
export function characterLimit(type : string, char : ChartType, max : number) : CharacterLengthResult {
|
||||||
|
const str = `${char}`;
|
||||||
|
|
||||||
|
if (str.length == 0) {
|
||||||
|
return {
|
||||||
|
length: 0,
|
||||||
|
characters: '',
|
||||||
|
} as CharacterLengthResult
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 'maxcharacter') {
|
||||||
|
let len = 0;
|
||||||
|
for (let i = 0; i < str.length; i += 1) {
|
||||||
|
let currentStringLength : number// = 0;
|
||||||
|
const code = str.charCodeAt(i)!
|
||||||
|
if (code > 127 || code == 94) {
|
||||||
|
currentStringLength = 2;
|
||||||
|
} else {
|
||||||
|
currentStringLength = 1;
|
||||||
|
}
|
||||||
|
if (len + currentStringLength > max) {
|
||||||
|
return {
|
||||||
|
length: len,
|
||||||
|
characters: str.slice(0, i),
|
||||||
|
} as CharacterLengthResult
|
||||||
|
}
|
||||||
|
len += currentStringLength;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
length: len,
|
||||||
|
characters: str,
|
||||||
|
} as CharacterLengthResult
|
||||||
|
} else if (type == 'maxlength') {
|
||||||
|
const length = str.length > max ? max : str.length;
|
||||||
|
return {
|
||||||
|
length: length,
|
||||||
|
characters: str.slice(0, length),
|
||||||
|
} as CharacterLengthResult
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
length: str.length,
|
||||||
|
characters: str,
|
||||||
|
} as CharacterLengthResult
|
||||||
|
};
|
||||||
@ -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>
|
||||||
|
|||||||
73
uni_modules/lime-shared/createCanvas/index.ts
Normal file
73
uni_modules/lime-shared/createCanvas/index.ts
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
|
||||||
|
// @ts-nocheck
|
||||||
|
// #ifndef UNI-APP-X && APP
|
||||||
|
import type { ComponentInternalInstance } from '@/uni_modules/lime-shared/vue'
|
||||||
|
import { getRect } from '@/uni_modules/lime-shared/getRect'
|
||||||
|
import { canIUseCanvas2d } from '@/uni_modules/lime-shared/canIUseCanvas2d'
|
||||||
|
export const isCanvas2d = canIUseCanvas2d()
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
|
||||||
|
export function createCanvas(canvasId : string, component : ComponentInternalInstance) {
|
||||||
|
// #ifdef UNI-APP-X
|
||||||
|
uni.createCanvasContextAsync({
|
||||||
|
canvasId,
|
||||||
|
component,
|
||||||
|
success(context : CanvasContext) {
|
||||||
|
|
||||||
|
},
|
||||||
|
fail(error : UniError) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
// #ifndef UNI-APP-X
|
||||||
|
const isCanvas2d = canIUseCanvas2d()
|
||||||
|
getRect('#' + canvasId, context, isCanvas2d).then(res => {
|
||||||
|
if (res.node) {
|
||||||
|
res.node.width = res.width
|
||||||
|
res.node.height = res.height
|
||||||
|
return res.node
|
||||||
|
} else {
|
||||||
|
const ctx = uni.createCanvasContext(canvasId, context)
|
||||||
|
if (!ctx._drawImage) {
|
||||||
|
ctx._drawImage = ctx.drawImage
|
||||||
|
ctx.drawImage = function (...args) {
|
||||||
|
const { path } = args.shift()
|
||||||
|
ctx._drawImage(path, ...args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ctx.getImageData) {
|
||||||
|
ctx.getImageData = function () {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.canvasGetImageData({
|
||||||
|
canvasId,
|
||||||
|
x: parseInt(arguments[0]),
|
||||||
|
y: parseInt(arguments[1]),
|
||||||
|
width: parseInt(arguments[2]),
|
||||||
|
height: parseInt(arguments[3]),
|
||||||
|
success(res) {
|
||||||
|
resolve(res)
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
reject(err)
|
||||||
|
}
|
||||||
|
}, context)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
getContext(type: string) {
|
||||||
|
if(type == '2d') {
|
||||||
|
return ctx
|
||||||
|
}
|
||||||
|
},
|
||||||
|
width: res.width,
|
||||||
|
height: res.height,
|
||||||
|
createImage
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
@ -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,36 +1,36 @@
|
|||||||
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 小数点后的位数
|
||||||
r1 = num1.toString().split('.')[1].length;
|
r1 = num1.toString().split('.')[1].length;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
r1 = 0;
|
r1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 获取 num2 小数点后的位数
|
// 获取 num2 小数点后的位数
|
||||||
r2 = num2.toString().split('.')[1].length;
|
r2 = num2.toString().split('.')[1].length;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
r2 = 0;
|
r2 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算需要扩大的倍数
|
// 计算需要扩大的倍数
|
||||||
m = Math.pow(10, Math.max(r1, r2));
|
m = Math.pow(10, Math.max(r1, r2));
|
||||||
|
|
||||||
// 返回相加结果
|
// 返回相加结果
|
||||||
return (num1 * m + num2 * m) / m;
|
return (num1 * m + num2 * m) / m;
|
||||||
}
|
}
|
||||||
45
uni_modules/lime-shared/floatDiv/index.ts
Normal file
45
uni_modules/lime-shared/floatDiv/index.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { floatMul } from '../floatMul';
|
||||||
|
import { isNumber } from '../isNumber';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 除法函数,用于处理浮点数除法并保持精度。
|
||||||
|
* @param {number} num1 - 被除数。
|
||||||
|
* @param {number} num2 - 除数。
|
||||||
|
* @returns {number} 除法运算的结果,保留正确的精度。
|
||||||
|
*/
|
||||||
|
export function floatDiv(num1:number, num2:number):number {
|
||||||
|
// 如果传入的不是数字类型,则打印警告并返回NaN
|
||||||
|
if (!isNumber(num1) || !isNumber(num2)) {
|
||||||
|
console.warn('请传入数字类型');
|
||||||
|
return NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
let m1 = 0, // 被除数小数点后的位数
|
||||||
|
m2 = 0, // 除数小数点后的位数
|
||||||
|
s1 = num1.toString(), // 将被除数转换为字符串
|
||||||
|
s2 = num2.toString(); // 将除数转换为字符串
|
||||||
|
|
||||||
|
// 计算被除数小数点后的位数
|
||||||
|
try {
|
||||||
|
m1 += s1.split('.')[1].length;
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
// 计算除数小数点后的位数
|
||||||
|
try {
|
||||||
|
m2 += s2.split('.')[1].length;
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
// 进行除法运算并处理小数点后的位数,使用之前定义的乘法函数保持精度
|
||||||
|
// #ifdef APP-ANDROID
|
||||||
|
return floatMul(
|
||||||
|
parseFloat(s1.replace('.', '')) / parseFloat(s2.replace('.', '')),
|
||||||
|
Math.pow(10, m2 - m1),
|
||||||
|
);
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-ANDROID
|
||||||
|
return floatMul(
|
||||||
|
Number(s1.replace('.', '')) / Number(s2.replace('.', '')),
|
||||||
|
Math.pow(10, m2 - m1),
|
||||||
|
);
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
44
uni_modules/lime-shared/floatMul/index.ts
Normal file
44
uni_modules/lime-shared/floatMul/index.ts
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import {isNumber} from '../isNumber';
|
||||||
|
// #ifdef APP-ANDROID
|
||||||
|
import BigDecimal from 'java.math.BigDecimal'
|
||||||
|
// import BigDecimal from 'java.math.BigDecimal'
|
||||||
|
// import StringBuilder from 'java.lang.StringBuilder'
|
||||||
|
// import java.math.BigDecimal;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乘法函数,用于处理浮点数乘法并保持精度。
|
||||||
|
* @param {number} num1 - 第一个乘数。
|
||||||
|
* @param {number} num2 - 第二个乘数。
|
||||||
|
* @returns {number} 乘法运算的结果,保留正确的精度。
|
||||||
|
*/
|
||||||
|
export function floatMul(num1 : number, num2 : number) : number {
|
||||||
|
if (!(isNumber(num1) || isNumber(num2))) {
|
||||||
|
console.warn('Please pass in the number type');
|
||||||
|
return NaN;
|
||||||
|
}
|
||||||
|
let m = 0;
|
||||||
|
// #ifdef APP-ANDROID
|
||||||
|
let s1 = BigDecimal.valueOf(num1.toDouble()).toPlainString(); //new UTSNumber(num1).toString() // //`${num1.toFloat()}`// num1.toString(),
|
||||||
|
let s2 = BigDecimal.valueOf(num2.toDouble()).toPlainString(); //new UTSNumber(num2).toString() //`${num2.toFloat()}`//.toString();
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-ANDROID
|
||||||
|
let s1:string = `${num1}`// num1.toString(),
|
||||||
|
let s2:string = `${num2}`//.toString();
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
try {
|
||||||
|
m += s1.split('.')[1].length;
|
||||||
|
} catch (error) { }
|
||||||
|
try {
|
||||||
|
m += s2.split('.')[1].length;
|
||||||
|
} catch (error) { }
|
||||||
|
|
||||||
|
// #ifdef APP-ANDROID
|
||||||
|
return parseFloat(s1.replace('.', '')) * parseFloat(s2.replace('.', '')) / Math.pow(10, m);
|
||||||
|
// #endif
|
||||||
|
// #ifndef APP-ANDROID
|
||||||
|
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m);
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
32
uni_modules/lime-shared/floatSub/index.ts
Normal file
32
uni_modules/lime-shared/floatSub/index.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import { isNumber } from '../isNumber';
|
||||||
|
/**
|
||||||
|
* 减法函数,用于处理浮点数减法并保持精度。
|
||||||
|
* @param {number} num1 - 被减数。
|
||||||
|
* @param {number} num2 - 减数。
|
||||||
|
* @returns {number} 减法运算的结果,保留正确的精度。
|
||||||
|
*/
|
||||||
|
export function floatSub(num1 : number, num2 : number) : number {
|
||||||
|
if (!(isNumber(num1) || isNumber(num2))) {
|
||||||
|
console.warn('Please pass in the number type');
|
||||||
|
return NaN;
|
||||||
|
}
|
||||||
|
let r1:number, r2:number, m:number, n:number;
|
||||||
|
try {
|
||||||
|
r1 = num1.toString().split('.')[1].length;
|
||||||
|
} catch (error) {
|
||||||
|
r1 = 0;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
r2 = num2.toString().split('.')[1].length;
|
||||||
|
} catch (error) {
|
||||||
|
r2 = 0;
|
||||||
|
}
|
||||||
|
m = Math.pow(10, Math.max(r1, r2));
|
||||||
|
n = r1 >= r2 ? r1 : r2;
|
||||||
|
// #ifndef APP-ANDROID
|
||||||
|
return Number(((num1 * m - num2 * m) / m).toFixed(n));
|
||||||
|
// #endif
|
||||||
|
// #ifdef APP-ANDROID
|
||||||
|
return parseFloat(((num1 * m - num2 * m) / m).toFixed(n));
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
@ -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) // 将空格、下划线和短横线替换为指定连接符
|
||||||
|
|||||||
11
uni_modules/lime-shared/obj2url/index.ts
Normal file
11
uni_modules/lime-shared/obj2url/index.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
// #ifndef UNI-APP-X
|
||||||
|
type UTSJSONObject = Record<string, any>
|
||||||
|
// #endif
|
||||||
|
export function obj2url(data: UTSJSONObject, isPrefix: boolean = false): string {
|
||||||
|
const prefix = isPrefix ? '?' : '';
|
||||||
|
const _result = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -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",
|
||||||
@ -48,9 +48,10 @@
|
|||||||
"vue3": "y"
|
"vue3": "y"
|
||||||
},
|
},
|
||||||
"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
|
||||||
|
|||||||
16
uni_modules/lime-shared/shuffle/index.ts
Normal file
16
uni_modules/lime-shared/shuffle/index.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
/**
|
||||||
|
* 随机化数组中元素的顺序,使用 Fisher-Yates 算法
|
||||||
|
* @description 函数接受一个数组作为参数,返回一个新的数组,其中包含原数组随机化顺序后的元素。
|
||||||
|
* @param arr 要随机化的数组
|
||||||
|
* @returns 一个新的数组,其中包含原数组随机化顺序后的元素。
|
||||||
|
*/
|
||||||
|
export function shuffle<T>(arr : T[]) : T[] {
|
||||||
|
for (let i = arr.length - 1; i > 0; i--) {
|
||||||
|
const j = Math.floor(Math.random() * (i + 1))
|
||||||
|
const temp = arr[i]
|
||||||
|
arr[i] = arr[j]
|
||||||
|
arr[j] = temp
|
||||||
|
}
|
||||||
|
return arr
|
||||||
|
}
|
||||||
@ -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
|
||||||
}
|
}
|
||||||
// 如果是其他单位,可以继续添加对应的转换逻辑
|
// 如果是其他单位,可以继续添加对应的转换逻辑
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,13 @@
|
|||||||
<view v-if="returnCodeOrID === 'orgCode'">
|
<view v-if="returnCodeOrID === 'orgCode'">
|
||||||
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true"
|
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true"
|
||||||
placeholder="请选择单位code" popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick"
|
placeholder="请选择单位code" popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick"
|
||||||
@popupclosed="onpopupclosed" @change="onchange" :map="{'text':'title','value':'orgCode'}"></uni-data-picker>
|
@popupclosed="onpopupclosed" :map="{'text':'title','value':'orgCode'}"
|
||||||
|
class="no-wrap-picker"></uni-data-picker>
|
||||||
</view>
|
</view>
|
||||||
<view v-else>
|
<view v-else>
|
||||||
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true" placeholder="请选择单位id"
|
<uni-data-picker v-model="selectDepartID" ref="depart" :openSearch="true" :ellipsis="true" placeholder="请选择单位id"
|
||||||
popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick" @popupclosed="onpopupclosed"
|
popup-title="请选择单位" :localdata="departList" @nodeclick="onnodeclick" @popupclosed="onpopupclosed"
|
||||||
@change="onchange" :map="{'text':'title','value':'id'}"></uni-data-picker>
|
:map="{'text':'title','value':'id'}" class="no-wrap-picker"></uni-data-picker>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
@ -29,6 +30,7 @@
|
|||||||
import {
|
import {
|
||||||
reactive,
|
reactive,
|
||||||
ref,
|
ref,
|
||||||
|
watch,
|
||||||
defineEmits,
|
defineEmits,
|
||||||
defineProps
|
defineProps
|
||||||
} from 'vue';
|
} from 'vue';
|
||||||
@ -45,15 +47,29 @@
|
|||||||
let selectDepartID = ref("") //当前选中的单位ID
|
let selectDepartID = ref("") //当前选中的单位ID
|
||||||
let selectDepartIDS = ref([]) //选中的级联单位ID数组
|
let selectDepartIDS = ref([]) //选中的级联单位ID数组
|
||||||
let tempSelectDepartID = ref("") //临时选择的单位ID
|
let tempSelectDepartID = ref("") //临时选择的单位ID
|
||||||
|
let depart = ref(null);
|
||||||
|
|
||||||
let departInfo = ref({}) //"单位的全部信息"
|
let departInfo = ref({}) //"单位的全部信息"
|
||||||
|
|
||||||
let $emit = defineEmits(['change']);
|
let $emit = defineEmits(['change']);
|
||||||
|
|
||||||
|
|
||||||
|
watch(
|
||||||
|
tempSelectDepartID,
|
||||||
|
(newVal,oldVal)=>{ //通过监听触发change by 闵
|
||||||
|
console.log(newVal)
|
||||||
|
$emit('change', newVal, departInfo)
|
||||||
|
},{
|
||||||
|
immediate:true,
|
||||||
|
deep:true
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
const getDepartList = () => {
|
const getDepartList = () => {
|
||||||
queryMyDeptTreeListApi().then((res) => {
|
queryMyDeptTreeListApi().then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// console.log(res)
|
console.log(res)
|
||||||
departList.value = res.result
|
departList.value = res.result
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@ -61,26 +77,41 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const onnodeclick = ((e) => {
|
const onnodeclick = ((e) => {
|
||||||
|
console.log(e)
|
||||||
departInfo.value = e;
|
departInfo.value = e;
|
||||||
if (props.returnCodeOrID = "orgCode") {
|
if (props.returnCodeOrID == "orgCode") {
|
||||||
tempSelectDepartID.value = e.orgCode
|
tempSelectDepartID.value = e.orgCode
|
||||||
} else {
|
} else {
|
||||||
tempSelectDepartID.value = e.value
|
tempSelectDepartID.value = e.value
|
||||||
}
|
}
|
||||||
|
// if(!depart.value.isOpened){//如果页面已经关闭 就触发change方法 by 闵
|
||||||
|
// $emit('change', selectDepartID.value, departInfo)
|
||||||
|
// }
|
||||||
})
|
})
|
||||||
|
|
||||||
const onchange = ((e) => {
|
const onchange = ((e) => {
|
||||||
$emit('change', e.detail.value[e.detail.value.length - 1].value, {})
|
console.log(e)
|
||||||
|
selectDepartID.value = e.detail.value[e.detail.value.length - 1].value
|
||||||
|
// $emit('change', e.detail.value[e.detail.value.length - 1].value, {})
|
||||||
})
|
})
|
||||||
|
|
||||||
const onpopupclosed = ((e) => {
|
const onpopupclosed = ((e) => {
|
||||||
|
console.log(e)
|
||||||
selectDepartID.value = tempSelectDepartID.value
|
selectDepartID.value = tempSelectDepartID.value
|
||||||
$emit('change', selectDepartID.value, departInfo)
|
// $emit('change', selectDepartID.value, departInfo)
|
||||||
})
|
})
|
||||||
onLoad((e) => {
|
onLoad((e) => {
|
||||||
getDepartList();
|
getDepartList();
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style scoped>
|
||||||
|
/* 选择器根据实际情况调整 */
|
||||||
|
.no-wrap-picker::v-deep .uni-data-picker-item {
|
||||||
|
white-space: nowrap;
|
||||||
|
/* 强制不换行 */
|
||||||
|
overflow: hidden;
|
||||||
|
/* 超出部分隐藏 */
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
/* 超出部分显示省略号 */
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@ -22,8 +22,8 @@
|
|||||||
<slot name="picker-loading" :loading="loading"></slot>
|
<slot name="picker-loading" :loading="loading"></slot>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-data-tree-cover" v-if="isOpened" @click="handleClose"></view>
|
<view class="uni-data-tree-cover" v-show="isOpened" @click="handleClose"></view>
|
||||||
<view class="uni-data-tree-dialog" v-if="isOpened">
|
<view class="uni-data-tree-dialog" v-show="isOpened">
|
||||||
<view class="uni-popper__arrow"></view>
|
<view class="uni-popper__arrow"></view>
|
||||||
<view class="dialog-caption">
|
<view class="dialog-caption">
|
||||||
<view class="dialog-title-view">
|
<view class="dialog-title-view">
|
||||||
|
|||||||
@ -25,8 +25,8 @@
|
|||||||
</view>
|
</view>
|
||||||
</slot>
|
</slot>
|
||||||
</view>
|
</view>
|
||||||
<view class="uni-data-tree-cover" v-if="isOpened" @click="handleClose"></view>
|
<view class="uni-data-tree-cover" v-show="isOpened" @click="handleClose"></view>
|
||||||
<view class="uni-data-tree-dialog" v-if="isOpened">
|
<view class="uni-data-tree-dialog" v-show="isOpened">
|
||||||
<view class="uni-popper__arrow"></view>
|
<view class="uni-popper__arrow"></view>
|
||||||
<view class="dialog-caption">
|
<view class="dialog-caption">
|
||||||
<view class="title-area">
|
<view class="title-area">
|
||||||
|
|||||||
@ -1,108 +1,117 @@
|
|||||||
<template>
|
<template>
|
||||||
<uni-row>
|
<uni-row>
|
||||||
<view v-for="(item,index) in data">
|
<view v-for="(item, index) in data">
|
||||||
<uni-col :span="item.titleSpan">
|
<uni-col :span="item.titleSpan">
|
||||||
<view class="titleStyle">
|
<view class="titleStyle">
|
||||||
{{item.title}}
|
{{ item.title }}
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="item.valueSpan">
|
<uni-col :span="item.valueSpan">
|
||||||
<view class="dataStyle">
|
<view :class="item.class">
|
||||||
{{ doEmptyString(item.value) }}
|
{{ doEmptyString(item.value) }}
|
||||||
</view>
|
</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
// 表格数据
|
// 表格数据
|
||||||
cellData: {
|
cellData: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => [{
|
default: () => [
|
||||||
title: "",
|
{
|
||||||
value: "",
|
title: '',
|
||||||
|
value: '',
|
||||||
titleSpan: 4,
|
titleSpan: 4,
|
||||||
valueSpan: 4
|
valueSpan: 4
|
||||||
}]
|
}
|
||||||
},
|
]
|
||||||
//每行数据组数 title value
|
|
||||||
rowDataCount: {
|
|
||||||
type: Number,
|
|
||||||
default: 3
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
data() {
|
//每行数据组数 title value
|
||||||
return {
|
rowDataCount: {
|
||||||
data: []
|
type: Number,
|
||||||
}
|
default: 3
|
||||||
},
|
}
|
||||||
watch: {
|
},
|
||||||
cellData: {
|
data() {
|
||||||
deep: true,
|
return {
|
||||||
immediate: true,
|
data: []
|
||||||
handler(val) {
|
};
|
||||||
let totalSpan = 0;
|
},
|
||||||
for (var i = 0; i < val.length; i++) { //根据每行数据组数 补齐栅格 24
|
watch: {
|
||||||
if ((i + 1) % this.rowDataCount != 0) {
|
cellData: {
|
||||||
totalSpan = totalSpan + val[i].titleSpan + val[i].valueSpan
|
deep: true,
|
||||||
} else {
|
immediate: true,
|
||||||
val[i].valueSpan = 24 - totalSpan - val[i].titleSpan;
|
handler(val) {
|
||||||
totalSpan = 0;
|
let totalSpan = 0;
|
||||||
}
|
for (var i = 0; i < val.length; i++) {
|
||||||
|
//根据每行数据组数 补齐栅格 24
|
||||||
|
if ((i + 1) % this.rowDataCount != 0) {
|
||||||
|
totalSpan = totalSpan + val[i].titleSpan + val[i].valueSpan;
|
||||||
|
} else {
|
||||||
|
val[i].valueSpan = 24 - totalSpan - val[i].titleSpan;
|
||||||
|
totalSpan = 0;
|
||||||
}
|
}
|
||||||
this.data = val;
|
|
||||||
// console.log(this.data)
|
|
||||||
}
|
}
|
||||||
|
this.data = val;
|
||||||
|
// console.log(this.data)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
methods: {
|
},
|
||||||
//数据如果为空,自动替换成/
|
methods: {
|
||||||
doEmptyString(obj) {
|
//数据如果为空,自动替换成/
|
||||||
let str = '/';
|
doEmptyString(obj) {
|
||||||
if (typeof(obj) == "undefined" || (obj) === null || (obj) === '') {
|
let str = '/';
|
||||||
return str;
|
if (typeof obj == 'undefined' || obj === null || obj === '' || obj === 'Na' || obj === 'N' || obj === '0') {
|
||||||
}
|
return str;
|
||||||
return obj + '';
|
|
||||||
}
|
}
|
||||||
|
return obj + '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 标签样式 */
|
/* 标签样式 */
|
||||||
.titleStyle {
|
.titleStyle {
|
||||||
font-size: 12px;
|
font-size: 10px;
|
||||||
color: #747474;
|
color: #747474;
|
||||||
line-height: 50px;
|
line-height: 30px;
|
||||||
height: 50px;
|
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-right: 1px solid #919191;
|
border-right: 1px solid #919191;
|
||||||
border-bottom: 1px solid #919191;
|
border-bottom: 1px solid #919191;
|
||||||
;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* 内容样式 */
|
/* 内容样式 */
|
||||||
.dataStyle {
|
.dataStyle {
|
||||||
max-font-size: 14px;
|
font-size: 12px;
|
||||||
/* 最大字体限制 */
|
color: #00007f;
|
||||||
min-font-size: 10px;
|
line-height: 35px;
|
||||||
/* 最小字体限制 */
|
height: 30px;
|
||||||
font-size: 14px;
|
font-weight: 500;
|
||||||
color: #00007f;
|
text-align: center;
|
||||||
line-height: 25px;
|
vertical-align: middle;
|
||||||
height: 50px;
|
border-bottom: 1px solid #919191;
|
||||||
font-weight: 500;
|
text-overflow: ellipsis;
|
||||||
text-align: center;
|
overflow: hidden;
|
||||||
vertical-align: middle;
|
}
|
||||||
border-bottom: 1px solid #919191;
|
|
||||||
text-overflow: ellipsis;
|
/* 内容样式 */
|
||||||
overflow: hidden;
|
.dataStyle1 {
|
||||||
}
|
font-size: 10px;
|
||||||
|
color: #00007f;
|
||||||
|
line-height: 15px;
|
||||||
|
height: 30px;
|
||||||
|
font-weight: 500;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: middle;
|
||||||
|
border-bottom: 1px solid #919191;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Loading…
Reference in New Issue
Block a user