Initial commit
This commit is contained in:
257
src/components/homeDialogInfo/index copy.vue
Normal file
257
src/components/homeDialogInfo/index copy.vue
Normal file
@ -0,0 +1,257 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog :title="titleValue" width="1400px" :model-value="modelValue" @close="closed">
|
||||
<div class="tabBox" style="margin-top: 0px">
|
||||
<el-table ref="multipleUserRef" @selection-change="handleSelectionChange" :data="tableData" border
|
||||
style="width: 100%" :row-key="keyid" height="450">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column property="gjsj" label="告警时间" />
|
||||
<el-table-column property="gjlx" label="告警类型" />
|
||||
<el-table-column property="nrms" label="告警内容描述" />
|
||||
<el-table-column property="czr" label="告警处置责任人" />
|
||||
<el-table-column property="czzt" label="告警处置状态" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="fenye" :style="{ top: tableHeight + 'px' }">
|
||||
<el-pagination class="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-page="listQuery.pageNum" :page-sizes="[2, 5, 10, 20]" :page-size="listQuery.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="closed">取消</el-button>
|
||||
<el-button type="primary" @click="onComfirm">确认</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from "element-plus";
|
||||
import { qcckGet, qcckPost } from "@/api/qcckApi.js";
|
||||
import {
|
||||
defineProps,
|
||||
watch,
|
||||
ref,
|
||||
onMounted,
|
||||
nextTick,
|
||||
getCurrentInstance
|
||||
} from "vue";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { D_BZ_SBLX, D_BZ_GZSBLX } = proxy.$dict("D_BZ_SBLX", "D_BZ_GZSBLX");
|
||||
const props = defineProps({
|
||||
//是否显示
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
//标题
|
||||
titleValue: {
|
||||
type: String,
|
||||
default: "选择感知源"
|
||||
},
|
||||
//是否多选
|
||||
multiple: {
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
//已经选中得数据回显
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
});
|
||||
const keyid = (row) => {
|
||||
return row.id;
|
||||
};
|
||||
const total = ref(0);
|
||||
const ridioIndex = ref(null);
|
||||
const listQuery = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
sblx: "",
|
||||
sbmc: ""
|
||||
});
|
||||
const tableData = ref([
|
||||
{
|
||||
gjsj: '2025/3/7 8:09',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“张辉”于“2025-3-7 08:01:14 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '谢婷',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/3/1 12:06',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“赵海波”于“2025-3-1 12:16:08 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '胡耀威',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/27 0:30',
|
||||
gjlx: '企业用工缺口率预警',
|
||||
nrms: '根据平台监测结果,“全友家私有限公司”大量存在招聘信息,供需比例已超出预警值,存在供给不足风险,请及时关注和处置。',
|
||||
czr: '何明',
|
||||
czzt: '未处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/24 11:44',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“钱力平”于“2025-2-24 11:44:07 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '谢婷',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/24 9:44',
|
||||
gjlx: '劳务经纪人差评聚集预警',
|
||||
nrms: '根据平台评价和智能客户呼叫中心回传监测结果显示,“崇阳街道石羊社区党群服务中心”服务站点“周屏”近期1月内存在4次差评,请关注处置。',
|
||||
czr: '周伟',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/4 18:19',
|
||||
gjlx: '社保缴纳异常',
|
||||
nrms: '现“崇庆街道彭庙社区党群服务中心”服务站点,经纪人“陈俊峰”办理入职人员“李友京”超过2月未缴纳社保,存在风险,请核实并处置。',
|
||||
czr: '陈俊峰',
|
||||
czzt: '未处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/2 10:18',
|
||||
gjlx: '技能错配指数',
|
||||
nrms: '系统监测,截止“2025/2/2 10:18:55”平台招聘技能岗位的入职人员存在技能错配指数低的风险,请增加相关岗位的报名人员技能培训。',
|
||||
czr: '何明',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/1 16:45',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“张勇”于“2025/2/1 16:45:24 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '谢婷',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/1/30 14:18',
|
||||
gjlx: '社保缴纳异常',
|
||||
nrms: '现“崇州市人社局人力资源服务市场”服务站点,经纪人“赵晓燕”办理入职人员“王浩”超过3月未缴纳社保,存在风险,请核实并处置。',
|
||||
czr: '赵晓燕',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/1/24 14:18',
|
||||
gjlx: '离职潮预警',
|
||||
nrms: '根据系统监测,截止目前离职提交人数已达到阈值范围,超同期3.7%,请关注!',
|
||||
czr: '胡耀威',
|
||||
czzt: '已处置'
|
||||
}
|
||||
]);
|
||||
const emits = defineEmits(["close", "choosedGzy"]);
|
||||
const closed = () => {
|
||||
emits("close", false);
|
||||
};
|
||||
const checkopenList = ref([]);
|
||||
//确认选中
|
||||
const onComfirm = () => {
|
||||
if (props.multiple) {
|
||||
//多选
|
||||
const List = multipleSelectionUser.value;
|
||||
if (List.length === 0) {
|
||||
proxy.$message.warning("请选择感知源");
|
||||
return;
|
||||
}
|
||||
emits("choosedGzy", [...List, ...checkopenList.value]);
|
||||
} else {
|
||||
//单选
|
||||
if (![ridioIndex.value][0]) {
|
||||
proxy.$message.warning("请选择感知源");
|
||||
return;
|
||||
}
|
||||
const info = tableData.value.find((item) => {
|
||||
return item.id === ridioIndex.value;
|
||||
});
|
||||
emits("choosedGzy", [info]);
|
||||
}
|
||||
closed();
|
||||
};
|
||||
onMounted(() => {
|
||||
getListData();
|
||||
});
|
||||
/**
|
||||
* pageSize 改变触发
|
||||
*/
|
||||
const handleSizeChange = (currentSize) => {
|
||||
listQuery.value.pageSize = currentSize;
|
||||
getListData();
|
||||
};
|
||||
|
||||
/**
|
||||
* 页码改变触发
|
||||
*/
|
||||
const handleCurrentChange = (currentPage) => {
|
||||
listQuery.value.pageNum = currentPage;
|
||||
getListData();
|
||||
};
|
||||
//圈层数据
|
||||
const getListData = async () => {
|
||||
qcckPost(listQuery.value, "/mosty-yszx/tbYsSxt/getPageList").then((res) => {
|
||||
tableData.value = res?.records;
|
||||
multipleUser(props.data, tableData.value);
|
||||
total.value = Number(res.total);
|
||||
});
|
||||
};
|
||||
|
||||
const multipleUserRef = ref(null); //表单
|
||||
//多选选中的数据
|
||||
const multipleSelectionUser = ref([]);
|
||||
const handleSelectionChange = (val) => {
|
||||
multipleSelectionUser.value = val;
|
||||
if (checkopenList.value) {
|
||||
for (let i = 0; i < multipleSelectionUser.value.length; i++) {
|
||||
const l = multipleSelectionUser.value[i];
|
||||
for (let j = 0; j < checkopenList.value.length; j++) {
|
||||
const z = checkopenList.value[j];
|
||||
if (l.id == z.id) {
|
||||
checkopenList.value.splice(j, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
//回显
|
||||
function multipleUser(row, list) {
|
||||
if (row) {
|
||||
row.forEach((item) => {
|
||||
list.forEach((select) => {
|
||||
let val = item.id ? item.id : item;
|
||||
if (val == select.id) {
|
||||
if (multipleUserRef.value) {
|
||||
multipleUserRef.value.toggleRowSelection(select, true);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "@/assets/css/layout.scss";
|
||||
@import "@/assets/css/element-plus.scss";
|
||||
|
||||
::v-deep .el-form--inline {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
::v-deep .el-radio__label {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.el-dialog {
|
||||
--el-dialog-bg-color: #001238 !important;
|
||||
}
|
||||
|
||||
.el-dialog__title {
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
297
src/components/homeDialogInfo/index.vue
Normal file
297
src/components/homeDialogInfo/index.vue
Normal file
@ -0,0 +1,297 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-dialog title="告警信息" width="1400px" :model-value="modelValue" @close="closed" custom-class="home_dialog">
|
||||
<div class="tabBox" style="margin-top: 0px">
|
||||
<el-table ref="multipleUserRef" :row-class-name="tableRowClassName" :data="tableData" border style="width: 100%"
|
||||
:row-key="keyid" height="500">
|
||||
<el-table-column type="index" width="50" />
|
||||
<el-table-column property="gjsj" label="告警时间" />
|
||||
<el-table-column property="gjlx" label="告警类型" />
|
||||
<el-table-column property="nrms" label="告警内容描述" />
|
||||
<el-table-column property="czr" label="告警处置责任人" />
|
||||
<el-table-column property="czzt" label="告警处置状态" />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="fenye" :style="{ top: tableHeight + 'px' }">
|
||||
<el-pagination class="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-page="listQuery.pageNum" :page-sizes="[2, 5, 10, 20]" :page-size="listQuery.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
|
||||
</div>
|
||||
<!-- <template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="closed">取消</el-button>
|
||||
<el-button type="primary" @click="onComfirm">确认</el-button>
|
||||
</div>
|
||||
</template> -->
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from "element-plus";
|
||||
import { qcckGet, qcckPost } from "@/api/qcckApi.js";
|
||||
import {
|
||||
defineProps,
|
||||
watch,
|
||||
ref,
|
||||
onMounted,
|
||||
nextTick,
|
||||
getCurrentInstance
|
||||
} from "vue";
|
||||
const { proxy } = getCurrentInstance();
|
||||
// const { D_BZ_SBLX, D_BZ_GZSBLX } = proxy.$dict("D_BZ_SBLX", "D_BZ_GZSBLX");
|
||||
const props = defineProps({
|
||||
//是否显示
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
//标题
|
||||
titleValue: {
|
||||
type: String,
|
||||
default: "选择感知源"
|
||||
},
|
||||
//是否多选
|
||||
multiple: {
|
||||
default: true,
|
||||
type: Boolean
|
||||
},
|
||||
//已经选中得数据回显
|
||||
data: {
|
||||
type: Array,
|
||||
default: []
|
||||
}
|
||||
});
|
||||
const keyid = (row) => {
|
||||
return row.id;
|
||||
};
|
||||
const total = ref(10);
|
||||
const ridioIndex = ref(null);
|
||||
const listQuery = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
sblx: "",
|
||||
sbmc: ""
|
||||
});
|
||||
const tableData = ref([
|
||||
{
|
||||
gjsj: '2025/3/7 8:09',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“张辉”于“2025-3-7 08:01:14 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '谢婷',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/3/1 12:06',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“赵海波”于“2025-3-1 12:16:08 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '胡耀威',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/27 0:30',
|
||||
gjlx: '企业用工缺口率预警',
|
||||
nrms: '根据平台监测结果,“全友家私有限公司”大量存在招聘信息,供需比例已超出预警值,存在供给不足风险,请及时关注和处置。',
|
||||
czr: '何明',
|
||||
czzt: '未处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/24 11:44',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“钱力平”于“2025-2-24 11:44:07 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '谢婷',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/24 9:44',
|
||||
gjlx: '劳务经纪人差评聚集预警',
|
||||
nrms: '根据平台评价和智能客户呼叫中心回传监测结果显示,“崇阳街道石羊社区党群服务中心”服务站点“周屏”近期1月内存在4次差评,请关注处置。',
|
||||
czr: '周伟',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/4 18:19',
|
||||
gjlx: '社保缴纳异常',
|
||||
nrms: '现“崇庆街道彭庙社区党群服务中心”服务站点,经纪人“陈俊峰”办理入职人员“李友京”超过2月未缴纳社保,存在风险,请核实并处置。',
|
||||
czr: '陈俊峰',
|
||||
czzt: '未处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/2 10:18',
|
||||
gjlx: '技能错配指数',
|
||||
nrms: '系统监测,截止“2025/2/2 10:18:55”平台招聘技能岗位的入职人员存在技能错配指数低的风险,请增加相关岗位的报名人员技能培训。',
|
||||
czr: '何明',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/2/1 16:45',
|
||||
gjlx: '用工风险预警',
|
||||
nrms: '平台监测到“张勇”于“2025/2/1 16:45:24 ”在平台投递了一份简历,根据系统核算,该人员存在大量异常入职和离职记录,请谨慎录用!',
|
||||
czr: '谢婷',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/1/30 14:18',
|
||||
gjlx: '社保缴纳异常',
|
||||
nrms: '现“崇州市人社局人力资源服务市场”服务站点,经纪人“赵晓燕”办理入职人员“王浩”超过3月未缴纳社保,存在风险,请核实并处置。',
|
||||
czr: '赵晓燕',
|
||||
czzt: '已处置'
|
||||
},
|
||||
{
|
||||
gjsj: '2025/1/24 14:18',
|
||||
gjlx: '离职潮预警',
|
||||
nrms: '根据系统监测,截止目前离职提交人数已达到阈值范围,超同期3.7%,请关注!',
|
||||
czr: '胡耀威',
|
||||
czzt: '已处置'
|
||||
}
|
||||
]);
|
||||
const emits = defineEmits(["close", "choosedGzy"]);
|
||||
const closed = () => {
|
||||
emits("close", false);
|
||||
};
|
||||
const tableRowClassName = ({
|
||||
row,
|
||||
rowIndex,
|
||||
}) => {
|
||||
if (rowIndex % 2 == 1) {
|
||||
return 'warning-row'
|
||||
} else if (rowIndex % 2 == 0) {
|
||||
return 'success-row'
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
const checkopenList = ref([]);
|
||||
//确认选中
|
||||
const onComfirm = () => {
|
||||
if (props.multiple) {
|
||||
//多选
|
||||
const List = multipleSelectionUser.value;
|
||||
if (List.length === 0) {
|
||||
proxy.$message.warning("请选择感知源");
|
||||
return;
|
||||
}
|
||||
emits("choosedGzy", [...List, ...checkopenList.value]);
|
||||
} else {
|
||||
//单选
|
||||
if (![ridioIndex.value][0]) {
|
||||
proxy.$message.warning("请选择感知源");
|
||||
return;
|
||||
}
|
||||
const info = tableData.value.find((item) => {
|
||||
return item.id === ridioIndex.value;
|
||||
});
|
||||
emits("choosedGzy", [info]);
|
||||
}
|
||||
closed();
|
||||
};
|
||||
onMounted(() => {
|
||||
});
|
||||
/**
|
||||
* pageSize 改变触发
|
||||
*/
|
||||
const handleSizeChange = (currentSize) => {
|
||||
listQuery.value.pageSize = currentSize;
|
||||
getListData();
|
||||
};
|
||||
|
||||
/**
|
||||
* 页码改变触发
|
||||
*/
|
||||
const handleCurrentChange = (currentPage) => {
|
||||
listQuery.value.pageNum = currentPage;
|
||||
getListData();
|
||||
};
|
||||
//圈层数据
|
||||
const getListData = async () => {
|
||||
qcckPost(listQuery.value, "/mosty-yszx/tbYsSxt/getPageList").then((res) => {
|
||||
tableData.value = res?.records;
|
||||
total.value = Number(res.total);
|
||||
});
|
||||
};
|
||||
|
||||
const multipleUserRef = ref(null); //表单
|
||||
//多选选中的数据
|
||||
const multipleSelectionUser = ref([]);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "@/assets/css/layout.scss";
|
||||
@import "@/assets/css/element-plus.scss";
|
||||
|
||||
::v-deep .el-form--inline {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
::v-deep .el-radio__label {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
.el-dialog {
|
||||
background: url("~@/assets/images/home_dia_bg.png")no-repeat;
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
.el-dialog__title {
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
.home_dialog {
|
||||
.el-dialog__close {
|
||||
font-size: 2.5vw;
|
||||
color: #0de0ff;
|
||||
}
|
||||
}
|
||||
|
||||
.el-table .warning-row {
|
||||
--el-table-tr-bg-color: rgb(9, 63, 92);
|
||||
}
|
||||
|
||||
.el-table .success-row {
|
||||
--el-table-tr-bg-color: rgb(2, 131, 94);
|
||||
}
|
||||
|
||||
.el-table thead tr {
|
||||
font-size: 1.2vw;
|
||||
background: linear-gradient(90deg, #07A5FF, rgba(12, 80, 96, 0));
|
||||
}
|
||||
|
||||
.el-table tbody tr {
|
||||
font-size: 1.2vw;
|
||||
}
|
||||
|
||||
.el-dialog__title {
|
||||
background: url("~@/assets/images/home_dialog_title.png")no-repeat;
|
||||
background-size: 100% 100%;
|
||||
width: 30vw;
|
||||
display: block;
|
||||
padding: 24px;
|
||||
font-size: 2vw;
|
||||
}
|
||||
|
||||
.tabBox {
|
||||
height: 500px !important;
|
||||
}
|
||||
|
||||
.fenye {
|
||||
margin-top: 16px;
|
||||
|
||||
.el-pagination__total {
|
||||
font-size: 1.4vw !important;
|
||||
}
|
||||
|
||||
.el-icon,
|
||||
.el-pagination__jump {
|
||||
font-size: 1.4vw !important;
|
||||
}
|
||||
|
||||
.el-input__inner {
|
||||
font-size: 1vw !important;
|
||||
}
|
||||
|
||||
.el-pager li {
|
||||
font-size: 1.4vw !important;
|
||||
}
|
||||
}
|
||||
</style>
|
97
src/components/statis.vue
Normal file
97
src/components/statis.vue
Normal file
@ -0,0 +1,97 @@
|
||||
|
||||
<template>
|
||||
<ul class="fp-box">
|
||||
<!-- 默认进来是7位,超过自动加 -->
|
||||
<li ref="lis" v-for="i in countStr.length > 5 ? countStr.length : props.len" :key="i" :class="bg">
|
||||
<!-- 每列中的10行数字 -->
|
||||
<span v-for="num in 10" :key="num">
|
||||
<span class="num-wrap">{{ num - 1 }}</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
<script setup>
|
||||
import { onMounted, ref, watch } from "vue";
|
||||
const props = defineProps({
|
||||
count: Number,
|
||||
bg: String,
|
||||
len: {
|
||||
type: Number,
|
||||
default: 7
|
||||
},
|
||||
height:{
|
||||
type:Number,
|
||||
default:32
|
||||
}, danw:{
|
||||
type: String,
|
||||
default:'px'
|
||||
}
|
||||
});
|
||||
const lis = ref();
|
||||
const list = ref([]);
|
||||
const countStr = ref(""); // 需要展示的数字
|
||||
const numberArr = ref([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); // 固定每列中的19行数字
|
||||
const numStr = ref(""); // 需要展示的数字字符串
|
||||
const numArr = ref([0, 0, 0, 0, 0, 0, 0]); // 默认展示7个数字数组
|
||||
watch(
|
||||
() => props.count,
|
||||
(val) => {
|
||||
let str = val.toString();
|
||||
let num = 0;
|
||||
if (str.length < props.len) num = props.len - str.length;
|
||||
for (let i = 0; i < num; i++) {
|
||||
str = "0" + str;
|
||||
}
|
||||
countStr.value = str;
|
||||
initNumCard();
|
||||
},
|
||||
{ immediate: true, deep: true }
|
||||
);
|
||||
onMounted(() => {
|
||||
initNumCard();
|
||||
});
|
||||
function initNumCard() {
|
||||
numStr.value = countStr.value;
|
||||
numArr.value = numStr.value.split("");
|
||||
const numArrlen = numArr.value.length;
|
||||
// 展示数字的处理,不够7位前面补0
|
||||
// 默认进来是7位,超过自动加
|
||||
for (let i = 0;i < (countStr.value.length > 5 ? countStr.value.length : props.len) - numArrlen;i++) {
|
||||
numArr.value.unshift(0);
|
||||
}
|
||||
if (lis.value) {
|
||||
lis.value.forEach((item, index) => {
|
||||
const ty = numArr.value[index];
|
||||
item.style.transform = `translateY(-${ty * props.height}${props.danw})`; // 滚动数字(li标签)
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.fp-box {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
li {
|
||||
width: 26px;
|
||||
height: 32px;
|
||||
flex-direction: column;
|
||||
transition: transform 1s ease-in-out;
|
||||
& > span {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
color: #ffffff;
|
||||
display: flex;
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
height: 32px;
|
||||
line-height: 25px;
|
||||
float: left;
|
||||
.num-wrap {
|
||||
font-family: "icrosoft YaHei";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user