提交 9f7b6bb1 authored 作者: 邓文彬's avatar 邓文彬

fix(操作日志): 修改完成

上级 8a6985b1
<template>
<view class="search-com">
<view class="search-com-left">
<uni-data-select
class="uni-search-item"
v-model="searchFrom.inspectionType"
:localdata="inspectArr"
@change="(e) => change(e, 'inspectionType')"
placeholder="全部巡检"
></uni-data-select>
<uni-data-select
class="uni-search-item"
v-model="searchFrom.iSync"
:localdata="synchronization"
placeholder="全部"
@change="(e) => change(e, 'iSynchronization')"
></uni-data-select>
<uni-data-select
class="uni-search-item"
v-model="searchFrom.isException"
:localdata="exceptionArr"
placeholder="有无异常"
@change="(e) => change(e, 'isException')"
></uni-data-select>
</view>
<view class="search-com-right">
<uni-datetime-picker
class="uni-datetime-picker"
type="daterange"
v-model="searchFrom.inspectionTime"
:border="false"
@change="(e) => change(e, 'inspectionTime')"
/>
</view>
</view>
</template>
<script>
export default {
data() {
return {
searchFrom: {
inspectionType: "", // 巡检类型
iSynchronization: "", // 同部数据
isException: "", // 有无异常
inspectionTime: "", // 时间选择
},
inspectArr: [
// { value: 0, text: "全部巡检" },
{ value: 1, text: "机房巡检" },
{ value: 2, text: "进到巡检" },
],
synchronization: [
// { value: 0, text: "全部" },
{ value: 1, text: "未同步" },
{ value: 2, text: "已同步" },
],
exceptionArr: [
{ value: 0, text: "有无异常" },
{ value: 1, text: "有异常" },
{ value: 2, text: "无异常" },
],
};
},
methods: {
change(e, key) {
this.searchFrom[key] = e;
this.$emit("change", this.searchFrom);
},
},
};
</script>
<style lang="less" scoped>
.search-com {
display: flex;
align-items: center;
.search-com-left {
display: flex;
align-items: center;
border: 1px solid;
flex: 1;
.uni-search-item {
margin-right: 12px;
width: 130px;
background: #fff;
border-radius: 4px;
border: none !important;
}
}
.search-com-right {
width: 300px;
.uni-datetime-picker {
background: #fff;
border: 1px solid;
}
}
}
</style>
......@@ -49,6 +49,7 @@
<view class="month-record-item" v-for="item in 20" :key="item">
<view class="seconed-title"> 2024年08月 </view>
<view class="inspect-list">
<InspectionItem />
</view>
......@@ -182,7 +183,7 @@ export default {
}
.month-list {
height: calc(100vh - 166px - 25px - 16px);
height: calc(100vh - 166px - 25px - 16px - 16px - 20px);
overflow: auto;
.month-record-item {
margin-bottom: 24px;
......
......@@ -23,32 +23,65 @@
</view>
<view class="button-group">
<view class="log-button">操作日志</view>
<view class="reset-password-button">修改密码?</view>
<view class="log-button" @click="lookLog">操作日志</view>
<view class="reset-password-button" @click="updatePassword"
>修改密码?</view
>
<view class="reset-password-button" @click="logOut">退出账号?</view>
</view>
</view>
<!-- 内容区 -->
<view class="right-container">
<!-- 首页 -->
<Content v-if="activeTabIndex == 0" />
<!-- 巡检管理 -->
<InspectionManagement v-if="activeTabIndex == 1" />
<!-- 同步管理 -->
<SynchronousManagement v-if="activeTabIndex == 2" />
<!-- 日志 -->
<OperLog v-if="activeTabIndex == 4" />
</view>
<!-- 退出账号弹出 -->
<uni-popup ref="inputDialog2" type="dialog">
<uni-popup-dialog
ref="inputClose2"
mode="base"
title="确定退出该账号?"
@confirm="dialogInputConfirm2"
>
</uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import InspectionItem from "@/components/inspectionItem/index.vue";
import Content from "./content.vue";
import InspectionManagement from "@/pages/inspectionManagement/index.vue";
import SynchronousManagement from "@/pages/synchronousManagement/index.vue";
import OperLog from "@/pages/index/operLog.vue"
import Content from "./content.vue";
export default {
components: {
InspectionItem,
Content
Content,
InspectionManagement,
SynchronousManagement,
OperLog
},
data() {
return {
activeTabIndex: 0,
activeTabIndex: 3,
tabList: [
{
defaultIcon: "iconfont icon-yingyongyewuguanli1",
......@@ -69,6 +102,39 @@ export default {
};
},
methods: {
// 修改密码
updatePassword() {
uni.navigateTo({
url: "/pages/index/editPd",
});
},
// 查看操作日志
lookLog() {
// console.log('查看操作日志');
// uni.navigateTo({
// url: "/pages/index/operLog",
// });
this.activeTabIndex = 4
},
//退出--弹出对话框
dialogInputConfirm2() {
let _this = this;
uni.redirectTo({
url: "/pages/login/login",
success() {
_this.$store.commit("SET_USER", {});
},
});
},
//退出
logOut() {
this.$refs.inputDialog2.open();
},
// 切换tab
tabClick(item, index) {
console.log("----");
this.activeTabIndex = index;
......@@ -180,6 +246,8 @@ export default {
flex: 1;
margin-left: 16px;
z-index: 10;
padding-top: 32px;
padding-right: 16px;
// .card-list {
// display: flex;
......
<template>
<view class="content">
<!-- 导航栏 -->
<uni-nav-bar dark :fixed="true" background-color="#5474e8" status-bar left-icon="left" left-text="返回"
@clickLeft="back" title="安全监管管理平台" />
<!-- <uni-nav-bar dark :fixed="true" background-color="#5474e8" status-bar left-icon="left" left-text="返回"
@clickLeft="back" title="安全监管管理平台" /> -->
<view class="main">
<!-- 搜索区域 -->
<view class="content-box box-shaow-box">
<view class="content_header">
操作日志(超管专用)
</view>
<view class="content_header"> 操作日志(超管专用) </view>
<view class="search-box-item">
<span class="text">操作模块:</span>
<uni-data-checkbox mode="tag" v-model="searchForm.type" :localdata="typeList"
@change="selectChange"></uni-data-checkbox>
<uni-data-checkbox
mode="tag"
v-model="searchForm.type"
:localdata="typeList"
@change="selectChange"
></uni-data-checkbox>
</view>
<view class="search-box-item pl">
<span class="text">时间:</span>
......@@ -26,12 +28,18 @@
<!-- 查询结果 -->
<view class="search-result">
<span class="search-result-text">查询结果:</span>
<span class="search-result-number">{{total}}</span>
<span class="search-result-number">{{ total }}</span>
</view>
</view>
<view class="table-box">
<uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据">
<uni-table
ref="table"
:loading="loading"
border
stripe
emptyText="暂无更多数据"
>
<uni-tr>
<uni-th width="60" align="center">序号</uni-th>
<uni-th align="center">角色</uni-th>
......@@ -40,10 +48,9 @@
<uni-th width="200" align="center">操作详情(名称+编号)</uni-th>
<uni-th align="center">操作类型</uni-th>
<uni-th align="center">操作时间</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableData" :key="index">
<uni-td>{{index+1}}</uni-td>
<uni-td>{{ index + 1 }}</uni-td>
<uni-td>{{ item.name }}</uni-td>
<uni-td>
<view class="name">{{ item.user }}</view>
......@@ -56,8 +63,13 @@
</uni-table>
</view>
<view class="uni-pagination-box">
<uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total"
@change="change" />
<uni-pagination
show-icon
:page-size="pageSize"
:current="pageCurrent"
:total="total"
@change="change"
/>
</view>
</view>
</view>
......@@ -65,15 +77,15 @@
</template>
<script>
import getDateTime from "@/common/getdateTime.js"
import timeSelect from "@/components/global/timeSelect.vue"
export default {
import getDateTime from "@/common/getdateTime.js";
import timeSelect from "@/components/global/timeSelect.vue";
export default {
components: {
timeSelect
timeSelect,
},
data() {
return {
searchVal: '',
searchVal: "",
allData: [],
tableData: [],
// 每页数据量
......@@ -83,153 +95,151 @@
// 数据总量
total: 0,
loading: false,
typeList: [{
text: '全部',
value: ''
typeList: [
{
text: "全部",
value: "",
},
{
text: '巡检',
value: '巡检'
text: "巡检",
value: "巡检",
},
{
text: '报修',
value: '报修'
text: "报修",
value: "报修",
},
{
text: '报告',
value: '报告'
text: "报告",
value: "报告",
},
{
text: '同步',
value: '同步'
text: "同步",
value: "同步",
},
{
text: '其他',
value: '其他'
text: "其他",
value: "其他",
},
],
searchForm: {
type: '',
startTime: '',
endTime: ''
type: "",
startTime: "",
endTime: "",
},
recordData: []
}
recordData: [],
};
},
created() {},
onNavigationBarButtonTap(val) {
uni.navigateBack()
uni.navigateBack();
},
onLoad() {
this.recordData = this.$store.state.oper_record
this.selectChange()
this.recordData = this.$store.state.oper_record;
this.selectChange();
},
methods: {
timeChange(val) {
this.searchForm.startTime = val.startTime
this.searchForm.endTime = val.endTime
this.selectChange()
this.searchForm.startTime = val.startTime;
this.searchForm.endTime = val.endTime;
this.selectChange();
},
selectChange() {
const {
type,
startTime,
endTime
} = this.searchForm
this.allData = this.recordData.filter(item => {
const { type, startTime, endTime } = this.searchForm;
this.allData = this.recordData.filter((item) => {
let matchType = true; // 类型筛选
let matchTime = true; // 时间筛选
if (type) {
matchType = item.module == type || item.type == type
matchType = item.module == type || item.type == type;
}
if (startTime && endTime) {
matchTime = Date.parse(item.time) <= Date.parse(endTime) && Date.parse(item.time) >= Date
.parse(startTime)
matchTime =
Date.parse(item.time) <= Date.parse(endTime) &&
Date.parse(item.time) >= Date.parse(startTime);
}
return matchType && matchTime
})
this.getData(1)
return matchType && matchTime;
});
this.getData(1);
},
back() {
uni.navigateBack()
uni.navigateBack();
},
// 分页触发
change(e) {
this.getData(e.current)
this.getData(e.current);
},
// 获取数据
getData(pageCurrent, value = '') {
this.loading = true
this.pageCurrent = pageCurrent
getData(pageCurrent, value = "") {
this.loading = true;
this.pageCurrent = pageCurrent;
this.request({
pageSize: this.pageSize,
pageCurrent: pageCurrent,
value: value,
success: res => {
success: (res) => {
// console.log('data', res);
this.tableData = res.data
this.total = res.total
this.loading = false
}
})
this.tableData = res.data;
this.total = res.total;
this.loading = false;
},
});
},
// 伪request请求
request(options) {
const {
pageSize,
pageCurrent,
success,
value
} = options
let total = this.allData.length
const { pageSize, pageCurrent, success, value } = options;
let total = this.allData.length;
let data = this.allData.filter((item, index) => {
const idx = index - (pageCurrent - 1) * pageSize
return idx < pageSize && idx >= 0
})
const idx = index - (pageCurrent - 1) * pageSize;
return idx < pageSize && idx >= 0;
});
if (value) {
data = []
this.allData.forEach(item => {
data = [];
this.allData.forEach((item) => {
if (item.name.indexOf(value) !== -1) {
data.push(item)
data.push(item);
}
})
total = data.length
});
total = data.length;
}
setTimeout(() => {
typeof success === 'function' &&
typeof success === "function" &&
success({
data: data,
total: total
})
}, 500)
}
}
}
total: total,
});
}, 500);
},
},
};
</script>
<style scoped lang="less">
/deep/.uni-table-scroll {
/deep/.uni-table-scroll {
max-height: 210rpx;
overflow-y: auto;
}
}
/deep/.page--active {
/deep/.page--active {
color: #5474e8;
color: #ffffff;
}
}
/deep/.uni-pagination__num-tag {
min-width: 30px
}
/deep/.uni-pagination__num-tag {
min-width: 30px;
}
.content {
.content {
.main {
width: 100%;
// height: 100%;
// background-color: red;
background-image: linear-gradient(0deg, #f3f6fa 0%, rgba(130, 153, 238, 0.73) 49%, #5474e8 100%);
background-image: linear-gradient(
0deg,
#f3f6fa 0%,
rgba(130, 153, 238, 0.73) 49%,
#5474e8 100%
);
background-size: 100% 40rpx;
background-repeat: no-repeat;
......@@ -295,7 +305,7 @@
.search-result {
.search-result-text {
color: rgba(119, 140, 162, .7);
color: rgba(119, 140, 162, 0.7);
margin-right: 5px;
}
......@@ -303,7 +313,6 @@
color: #32343b;
}
}
}
.table-box {
......@@ -311,5 +320,5 @@
}
}
}
}
}
</style>
<template>
<view class="inspection-management">
<!-- 搜索项 -->
<SearchCom @change="change" />
<!-- 结果 -->
<view class="inspection-management-content">
<view class="count-tatal">
<text class="num">123条</text>
<text>查询结果</text>
</view>
<view class="month-list">
<!-- 每月记录 -->
<view class="month-record-item" v-for="item in 20" :key="item">
<view class="seconed-title"> 2024年08月 </view>
<view class="inspect-list">
<InspectionItem />
</view>
</view>
</view>
</view>
<!-- 开始巡检 -->
<view class="inspection-button">开始巡检</view>
</view>
</template>
<script>
import SearchCom from "@/components/searchCom/index.vue";
import InspectionItem from "@/components/inspectionItem/index.vue";
export default {
components: {
SearchCom,
InspectionItem,
},
data() {
return {};
},
methods: {
change(e) {
console.log("----", e);
},
},
};
</script>
<style scoped lang="less">
.inspection-management {
padding-top: 16px;
.count-tatal {
margin: 16px 0 8px 0;
font-size: 14px;
color: #4a4a4a;
font-weight: 400;
.num {
font-size: 18px;
color: #3774f6;
line-height: 26px;
font-weight: 500;
}
}
.inspection-management-content {
.month-list {
height: calc(100vh - 26px - 16px - 8px - 36px - 62px);
border: 1px solid;
overflow: auto;
.seconed-title {
margin-top: 16px;
font-size: 18px;
color: #000000;
font-weight: bold;
}
.month-record-item {
margin-bottom: 24px;
&:last-of-type {
margin: 0;
}
.inspect-list {
display: flex;
flex-wrap: wrap;
}
}
}
}
.inspection-button {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 60px;
width: 240px;
height: 40px;
left: 50%;
color: #fff;
transform: translateX(-50%);
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px;
}
}
</style>
......@@ -41,7 +41,7 @@ export default {
return {
person: {
user: "test",
pd: "Aa123456789",
pd: "Aa123456",
},
backButtonPress: 0,
personList: [],
......@@ -112,10 +112,10 @@ export default {
// 点击登录
login() {
// url: "/pages/index/index",
uni.navigateTo({
url: "/pages/home/home",
});
return;
// uni.navigateTo({
// url: "/pages/home/home",
// });
// return;
// 是否输入账号密码
if (this.person.user && this.person.pd) {
......
......@@ -51,7 +51,7 @@
<uni-forms-item label="客户单位:" required>
<hintInput :maxlength="50" :disabled="!baseFormData.customerUnit"
v-model="baseFormData.customerUnit" @fous="showDialogType('unit')"
:configData='dialogCofig' :isShow="dialogShow">
:configData='dialogCofig' :isShow=hintInput"dialogShow">
</hintInput>
</uni-forms-item>
</uni-col>
......
<template>
<view class="synchronous-dialog">
<view class="synchronous-content">
<view class="row-item">
<text class="title">待打包数据</text>
</view>
<view class="row-item count-num">
<text class="num">132</text>
<text></text>
</view>
<view class="operating-instructions">
<view class="title">操作说明:</view>
<view class="instructions-item">
1、在PAD端,点击“数据打包”,做好同步准备。
</view>
<view class="instructions-item">
2、完成打包后,将PAD直联PC机,等待PC机自动导入需同步记录。
</view>
<view class="instructions-item">
3、PC端自动导入完成后,请点击“同步数据”,同步成功后,列表自动刷新展示同步数据;且PAD同步的数据不支持修改。
</view>
</view>
<view class="row-item bottom-row">
<button class="button" :loading="loading" @click="packedData">
数据打包
</button>
</view>
<!-- 关闭按钮 -->
<div class="close-button">
<text class="iconfont icon-a-bianzu16beifen" @click="close"></text>
</div>
</view>
</view>
</template>
<script>
import {
SYNCHRONIZE_DATA_PAD,
checkAndCreateDirectory,
createFileWithPlusIO,
setSm2,
TEST,
} from "@/utils/systemCofig";
import getDateTime from "@/common/getdateTime.js";
export default {
components: {},
data() {
return {
loading: false,
};
},
methods: {
change(e) {
console.log("----", e);
},
close() {
this.$emit("close");
},
packedData() {
this.loading = true;
const userName = this.$store.state.now_user.name;
let timeStr = getDateTime.dateTimeStr("y-m-d h-i-s");
let fileName = `${userName}${timeStr}.txt`;
const fileContent = setSm2(TEST);
createFileWithPlusIO(
`${SYNCHRONIZE_DATA_PAD}/同步数据`,
fileName,
fileContent
)
.then((res) => {
console.log("---写入成功", res);
uni.showToast({
title: "打包成功",
icon: "none",
duration: 2000,
});
this.loading = false;
this.close()
})
.catch(() => {
uni.showToast({
title: "打包失败",
icon: "none",
duration: 2000,
});
this.loading = false;
});
},
},
};
</script>
<style scoped lang="less">
.synchronous-dialog {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
.synchronous-content {
padding: 3% 20px 32px 24px;
width: 400px;
height: 60%;
box-sizing: border-box;
background-image: linear-gradient(
-6deg,
#f9ffe7 0%,
#ffffff 12%,
#fcfeff 73%,
#ccf1ff 100%
);
border: 0.4px solid rgba(224, 224, 224, 1);
border-radius: 12px;
position: relative;
.row-item {
display: flex;
align-items: center;
justify-content: center;
}
.title {
font-family: PingFangSC-Medium;
font-size: 18px;
color: #000000;
text-align: center;
line-height: 26px;
font-weight: 500;
}
.count-num {
margin: 5% 0 5% 0;
align-items: flex-end;
.num {
display: inline-block;
font-family: AlibabaPuHuiTi_2_65_Medium;
font-size: 50px;
color: #3774f6;
line-height: 44px;
font-weight: 500;
}
}
.operating-instructions {
margin-bottom: 8%;
.title {
font-size: 13px;
color: #4a4a4a;
line-height: 24px;
font-weight: 600;
text-align: left;
}
.instructions-item {
font-size: 12px;
color: #7c7c7c;
line-height: 22px;
font-weight: 400;
}
}
// 打包按钮
.bottom-row {
position: absolute;
bottom: 24px;
left: 50%;
transform: translateX(-50%);
.button {
display: flex;
align-items: center;
justify-content: center;
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px;
width: 160px;
height: 40px;
color: #fff;
}
}
// 关闭按钮
.close-button {
position: absolute;
bottom: -40px;
left: 50%;
transform: translateX(-50%);
.iconfont {
color: #fff;
font-size: 24px;
}
}
}
}
</style>
<template>
<view class="synchronous-management">
<!-- 搜索项 -->
<SearchCom @change="change" />
<!-- 结果 -->
<view class="synchronous-management-content">
<view class="count-tatal">
<text class="num">123条</text>
<text>查询结果</text>
</view>
<view class="month-list">
<!-- 每月记录 -->
<view class="month-record-item" v-for="item in 20" :key="item">
<view class="seconed-title"> 2024年08月 </view>
<view class="inspect-list">
<InspectionItem />
</view>
</view>
</view>
</view>
<!-- 数据打包 -->
<view class="synchronous-button" @click="openDialog(true)">数据打包</view>
<!-- 打包弹窗 -->
<Dialog v-show="isDialog" @close="openDialog(false)"></Dialog>
</view>
</template>
<script>
import SearchCom from "@/components/searchCom/index.vue";
import InspectionItem from "@/components/inspectionItem/index.vue";
import Dialog from "./dialog.vue";
export default {
components: {
SearchCom,
InspectionItem,
Dialog
},
data() {
return {
isDialog: false, //
};
},
methods: {
change(e) {
console.log("----", e);
},
openDialog(show){
this.isDialog = show;
}
},
};
</script>
<style scoped lang="less">
.synchronous-management {
padding-top: 16px;
.count-tatal {
margin: 16px 0 8px 0;
font-size: 14px;
color: #4a4a4a;
font-weight: 400;
.num {
font-size: 18px;
color: #3774f6;
line-height: 26px;
font-weight: 500;
}
}
.synchronous-management-content {
.month-list {
height: calc(100vh - 26px - 16px - 8px - 36px - 62px);
border: 1px solid;
overflow: auto;
.seconed-title {
margin-top: 16px;
font-size: 18px;
color: #000000;
font-weight: bold;
}
.month-record-item {
margin-bottom: 24px;
&:last-of-type {
margin: 0;
}
.inspect-list {
display: flex;
flex-wrap: wrap;
}
}
}
}
.synchronous-button {
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 60px;
width: 240px;
height: 40px;
left: 50%;
color: #fff;
transform: translateX(-50%);
background-image: linear-gradient(180deg, #3773f6 0%, #2c57f6 99%);
box-shadow: 0px 10px 24px 0px rgba(51, 104, 246, 0.24);
border-radius: 27px;
}
}
</style>
## 1.0.8(2024-03-28)
- 修复 在vue2下:style动态绑定导致编译失败的bug
## 1.0.7(2024-01-20)
- 修复 长文本回显超过容器的bug,超过容器部分显示省略号
## 1.0.6(2023-04-12)
- 修复 微信小程序点击时会改变背景颜色的 bug
## 1.0.5(2023-02-03)
- 修复 禁用时会显示清空按钮
## 1.0.4(2023-02-02)
......
......@@ -4,14 +4,18 @@
<view class="uni-stat-box" :class="{'uni-stat__actived': current}">
<view class="uni-select" :class="{'uni-select--disabled':disabled}">
<view class="uni-select__input-box" @click="toggleSelector">
<view v-if="current" class="uni-select__input-text">{{current}}</view>
<view v-if="current" class="uni-select__input-text">{{textShow}}</view>
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
<uni-icons v-if="current && clear && !disabled" type="clear" color="#c0c4cc" size="24" @click="clearVal" />
<uni-icons v-else :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
<view v-if="current && clear && !disabled" @click.stop="clearVal">
<uni-icons type="clear" color="#c0c4cc" size="24" />
</view>
<view v-else>
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
</view>
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" v-if="showSelector">
<view class="uni-popper__arrow"></view>
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
<view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{emptyTips}}</text>
......@@ -39,11 +43,14 @@
* @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
* @property {String} placement 弹出位置
* @value top 顶部弹出
* @value bottom 底部弹出(default)
* @event {Function} change 选中发生变化触发
*/
export default {
name: "uni-stat-select",
name: "uni-data-select",
mixins: [uniCloud.mixinDatacom || {}],
props: {
localdata: {
......@@ -89,6 +96,10 @@
type: String,
default: ''
},
placement: {
type: String,
default: 'bottom'
}
},
data() {
return {
......@@ -121,15 +132,32 @@
common + placeholder :
common
},
valueCom(){
valueCom() {
// #ifdef VUE3
return this.modelValue;
// #endif
// #ifndef VUE3
return this.value;
// #endif
},
textShow() {
// 长文本显示
let text = this.current;
if (text.length > 10) {
return text.slice(0, 25) + '...';
}
return text;
},
getOffsetByPlacement() {
switch (this.placement) {
case 'top':
return "bottom:calc(100% + 12px);";
case 'bottom':
return "top:calc(100% + 12px);";
}
}
},
watch: {
localdata: {
immediate: true,
......@@ -149,10 +177,11 @@
this.initDefVal()
}
}
}
},
},
methods: {
debounce(fn, time = 100){
debounce(fn, time = 100) {
let timer = null
return function(...args) {
if (timer) clearTimeout(timer)
......@@ -162,11 +191,11 @@
}
},
// 执行数据库查询
query(){
query() {
this.mixinDatacomEasyGet();
},
// 监听查询条件变更事件
onMixinDatacomPropsChange(){
onMixinDatacomPropsChange() {
if (this.collection) {
this.debounceGet();
}
......@@ -227,9 +256,9 @@
}
},
emit(val) {
this.$emit('change', val)
this.$emit('input', val)
this.$emit('update:modelValue', val)
this.$emit('change', val)
if (this.collection) {
this.setCache(val);
}
......@@ -254,7 +283,7 @@
let str = "";
str = this.format;
for (let key in item) {
str = str.replace(new RegExp(`{${key}}`,"g"),item[key]);
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
}
return str;
} else {
......@@ -268,26 +297,26 @@
}
},
// 获取当前加载的数据
getLoadData(){
getLoadData() {
return this.mixinDatacomResData;
},
// 获取当前缓存key
getCurrentCacheKey(){
getCurrentCacheKey() {
return this.collection;
},
// 获取缓存
getCache(name=this.getCurrentCacheKey()){
getCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
return cacheData[name];
},
// 设置缓存
setCache(value, name=this.getCurrentCacheKey()){
setCache(value, name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
cacheData[name] = value;
uni.setStorageSync(this.cacheKey, cacheData);
},
// 删除缓存
removeCache(name=this.getCurrentCacheKey()){
removeCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
delete cacheData[name];
uni.setStorageSync(this.cacheKey, cacheData);
......@@ -302,7 +331,6 @@
$uni-secondary-color: #909399 !default;
$uni-border-3: #e5e5e5;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
.hide-on-phone {
......@@ -315,7 +343,9 @@
display: flex;
align-items: center;
// padding: 15px;
/* #ifdef H5 */
cursor: pointer;
/* #endif */
width: 100%;
flex: 1;
box-sizing: border-box;
......@@ -401,7 +431,6 @@
box-sizing: border-box;
/* #endif */
position: absolute;
top: calc(100% + 12px);
left: 0;
width: 100%;
background-color: #FFFFFF;
......@@ -419,6 +448,15 @@
/* #endif */
}
/* #ifdef H5 */
@media (min-width: 768px) {
.uni-select__selector-scroll {
max-height: 600px;
}
}
/* #endif */
.uni-select__selector-empty,
.uni-select__selector-item {
/* #ifndef APP-NVUE */
......@@ -449,8 +487,11 @@
}
/* picker 弹出层通用的指示小三角 */
.uni-popper__arrow,
.uni-popper__arrow::after {
.uni-popper__arrow_bottom,
.uni-popper__arrow_bottom::after,
.uni-popper__arrow_top,
.uni-popper__arrow_top::after,
{
position: absolute;
display: block;
width: 0;
......@@ -460,7 +501,7 @@
border-width: 6px;
}
.uni-popper__arrow {
.uni-popper__arrow_bottom {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
......@@ -469,7 +510,7 @@
border-bottom-color: #EBEEF5;
}
.uni-popper__arrow::after {
.uni-popper__arrow_bottom::after {
content: " ";
top: 1px;
margin-left: -6px;
......@@ -477,6 +518,24 @@
border-bottom-color: #fff;
}
.uni-popper__arrow_top {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
bottom: -6px;
left: 10%;
margin-right: 3px;
border-bottom-width: 0;
border-top-color: #EBEEF5;
}
.uni-popper__arrow_top::after {
content: " ";
bottom: 1px;
margin-left: -6px;
border-bottom-width: 0;
border-top-color: #fff;
}
.uni-select__input-text {
// width: 280px;
width: 100%;
......@@ -498,5 +557,6 @@
bottom: 0;
right: 0;
left: 0;
z-index: 2;
}
</style>
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "1.0.5",
"version": "1.0.8",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
......@@ -43,7 +43,8 @@
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论