Merge branch 'ldeyun' into 'master'

Ldeyun

See merge request cxcxt/cxc-szcx-uniapp!10
This commit is contained in:
闵 年泽 2025-02-18 14:22:21 +08:00
commit 421709bd29
27 changed files with 6149 additions and 1135 deletions

View File

@ -1,4 +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 #VITE_REQUEST_BASE_URL = http://10.75.166.6:8080

View File

@ -1,4 +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 #VITE_REQUEST_BASE_URL = http://10.75.15.247:8080

16
api/common.js Normal file
View 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
})
}

View File

@ -90,6 +90,14 @@ export function cxcRyDatAstatistics(parm) { // 员工分组统计
}) })
} }
export function cxcRyDatAstatisticsCertificate(parm) { // 员工按证件分组统计
return https({
url: '/cxc_rlzy.zb/cxcRlzyZb/getStatisticsCertificate',
method: 'get',
data: parm
})
}
export function cxcRyDatAstatisticsDetails(parm) { // 员工信息统计 export function cxcRyDatAstatisticsDetails(parm) { // 员工信息统计
return https({ return https({
url: '/cxc_rlzy.zb/cxcRlzyZb/details', url: '/cxc_rlzy.zb/cxcRlzyZb/details',

95
package-lock.json generated
View File

@ -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"
}
}
}
}

View File

@ -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) {

File diff suppressed because it is too large Load Diff

View File

@ -12,38 +12,31 @@
</uni-card> </uni-card>
<uni-card :is-shadow="false"> <uni-card :is-shadow="false">
<button type="primary" @click="toQtTongji">其他统计</button> <button type="primary" @click="toQtTongji">通用字段统计</button>
</uni-card>
</uni-section>
<uni-section title="人员统计" type="line">
<uni-card :is-shadow="false">
<button type="primary">人员统计</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() { function toQtTongji() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/views/renliziyuan/renyuanxinxi/qttongji" url: '/pages/views/renliziyuan/renyuanxinxi/qttongji'
}) });
} }
</script> </script>
<style> <style></style>
</style>

File diff suppressed because it is too large Load Diff

View File

@ -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>

View File

@ -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>

View 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>

View 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"
}
}
}
}
}

View File

@ -0,0 +1 @@
# cxc-szcx-dictSelect

File diff suppressed because it is too large Load Diff

View 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
}

View 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;
}
};

View 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
};

View 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
}

View 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
}

View 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
}

View 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
}

View 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 = [];
}

View 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
}

View File

@ -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" @change="onchange" :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> @change="onchange" :map="{'text':'title','value':'id'}" class="no-wrap-picker"></uni-data-picker>
</view> </view>
</template> </template>
@ -82,5 +83,14 @@
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>

View File

@ -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;
</style> 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>