Commit f6941768 by LJM

异常管理

parent 8d53b745
Showing with 4354 additions and 1641 deletions
...@@ -11,6 +11,14 @@ ...@@ -11,6 +11,14 @@
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
} }
.icon-danxuanxuanzhong-weixuanzhong:before {
content: "\e605";
}
.icon-danxuankuangdanxuan-xuanzhong-weixuanzhong:before {
content: "\e601";
}
.icon-a-juxing21:before { .icon-a-juxing21:before {
content: "\e794"; content: "\e794";
} }
......
.page-box {
padding: 15rpx 22rpx;
.time-interval {
margin-bottom: 15rpx;
.time-interval-box {
width: 48%;
height: 60rpx;
background: #ffffff;
border-radius: 10rpx;
padding-left: 17rpx;
padding-right: 10rpx;
box-sizing: border-box;
.iconfont {
font-size: 30rpx;
color: #919399;
}
.uni-input {
margin-left: 13rpx;
font-size: 24rpx;
}
}
}
.search-box {
height: 60rpx;
background: #ffffff;
border-radius: 10rpx;
padding: 0 18rpx 0 0;
.sn {
width: 164rpx;
height: 35rpx;
border-right: 1px solid #f0f0f2;
.uni-input {
font-size: 28rpx;
color: #292b33;
font-weight: bold;
}
.uni-arrow {
width: 14rpx;
height: 9rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/10/e4c72319ad41ce1425f71cc6ec35f111.png') no-repeat center;
background-size: contain;
margin-left: 12rpx;
}
}
.search-bar {
width: calc(100% - 164rpx);
.icon-juxing11 {
font-size: 30rpx;
color: #919399;
margin-left: 17rpx;
margin-right: 13rpx;
}
.uni-input {
font-size: 28rpx;
color: #484b59;
}
.icon-a-juxing111 {
font-size: 30rpx;
color: #c6c7cc;
}
}
}
.radio-box {
height: 80rpx;
.radio {
white-space: nowrap;
font-size: 24rpx;
}
}
.total-text {
margin-top: 15rpx;
font-size: 28rpx;
color: #919399;
text-align: right;
text {
padding: 0 5rpx;
color: #1969f9;
}
}
.list {
margin-top: 15rpx;
padding-bottom: 100rpx;
.box {
position: relative;
padding: 15px 17rpx 18rpx 17rpx;
background: #ffffff;
box-shadow: 0px 3rpx 3rpx 0px rgba(198, 199, 204, 0.3);
border-radius: 10rpx;
margin-bottom: 15rpx;
flex-wrap: wrap;
border: 1px solid transparent;
.check-box-icon {
position: absolute;
right: 18rpx;
top: 17rpx;
width: 20rpx;
height: 20rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/11/0bf30da3e8ce6c476c210173b5f13d51.png') no-repeat center;
background-size: contain;
display: block;
}
&.curr {
border: 1px solid #1969f9;
.check-box-icon {
background: url('https://img.ichunt.com/images/ichunt/202304/11/71a74e52e94bcf2e89f8df9817d494c6.png') no-repeat center;
background-size: contain;
}
}
.input-box {
margin-bottom: 18rpx;
flex: 0 0 50%;
.bor {
height: 1px;
background-color: #f0f0f2;
color: #f0f0f2;
margin-bottom: 10rpx;
}
.label {
width: 132rpx;
font-size: 28rpx;
color: #919399;
white-space: nowrap;
}
.text {
font-size: 28rpx;
color: #484b59;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.desc {
font-size: 28rpx;
color: #484b59;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.tt {
font-size: 28rpx;
color: #1969f9;
}
.pick_img_list {
flex-wrap: wrap;
.default {
width: 120rpx;
height: 120rpx;
background: #f5f5f7;
border-radius: 10rpx;
margin-right: 15rpx;
.iconfont {
font-size: 60rpx;
color: #c6c7cc;
}
}
.img_list {
position: relative;
width: 120rpx;
height: 120rpx;
background: #f5f5f7;
border-radius: 10rpx;
margin-right: 15rpx;
margin-bottom: 15rpx;
image {
width: 120rpx;
height: 120rpx;
}
.iconfont {
position: absolute;
right: 0;
top: 0;
font-size: 30rpx;
color: #ff3700;
z-index: 9;
}
}
}
}
.pick_img_list {
flex-wrap: wrap;
.default {
width: 120rpx;
height: 120rpx;
background: #f5f5f7;
border-radius: 10rpx;
margin-right: 15rpx;
.iconfont {
font-size: 60rpx;
color: #c6c7cc;
}
}
.img_list {
position: relative;
width: 120rpx;
height: 120rpx;
background: #f5f5f7;
border-radius: 10rpx;
margin-right: 15rpx;
margin-bottom: 15rpx;
image {
width: 120rpx;
height: 120rpx;
}
.iconfont {
position: absolute;
right: 0;
top: 0;
font-size: 30rpx;
color: #ff3700;
z-index: 9;
}
}
}
.btn-box {
width: 100%;
justify-content: flex-end;
.btn1 {
width: 100rpx;
height: 48rpx;
background: #fff;
border-radius: 4rpx;
font-size: 24rpx;
color: #999;
border: 1px solid #999;
}
.btn2 {
width: 100rpx;
height: 48rpx;
background: #1969f9;
border-radius: 8rpx;
font-size: 25rpx;
color: #ffffff;
margin-left: 14rpx;
}
}
.status-box {
position: absolute;
right: 10rpx;
top: 5rpx;
.staus_type_val {
font-size: 28rpx;
color: #1969f9;
border: 1px solid #f0f0f2;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
margin-right: 10rpx;
}
}
}
}
.fix-btn {
position: fixed;
bottom: 0;
width: 100%;
left: 0;
z-index: 999;
.btn1 {
width: 128rpx;
height: 75rpx;
background: #ffffff;
border-right: 1px solid #f0f0f2;
.check-box-icon {
width: 20rpx;
height: 20rpx;
background: url('https://img.ichunt.com/images/ichunt/202304/11/0bf30da3e8ce6c476c210173b5f13d51.png') no-repeat center;
background-size: contain;
display: block;
&.curr {
background: url('https://img.ichunt.com/images/ichunt/202304/11/71a74e52e94bcf2e89f8df9817d494c6.png') no-repeat center;
background-size: contain;
}
}
.text {
margin-left: 10rpx;
font-size: 20rpx;
color: #484b59;
}
}
.btn2 {
width: 300rpx;
height: 75rpx;
background: #02a7f0;
font-size: 23rpx;
color: #ffffff;
}
.btn3 {
width: calc(100% - 428rpx);
height: 75rpx;
background: #1969f9;
font-size: 23rpx;
color: #ffffff;
}
}
}
.no-date {
padding: 30rpx 0;
.iconfont {
font-size: 180rpx;
color: #c6c7cc;
margin-bottom: 30rpx;
}
.text {
font-size: 20rpx;
color: #484b59;
}
}
::v-deep .uni-popup__wrapper {
width: 95% !important;
}
.popup-content {
background-color: #f1f4f6;
padding: 50rpx 0 0 0;
border-radius: 10rpx;
.section {
padding: 0 24rpx;
min-height: 120rpx;
padding-bottom: 80rpx;
.input-box {
margin-bottom: 30rpx;
.label {
font-size: 26rpx;
color: #6e767a;
white-space: nowrap;
}
.tt {
font-weight: bold;
font-size: 28rpx;
color: #404547;
}
.uni-input {
width: 310rpx;
height: 55rpx;
background: #e6edf0;
border-radius: 4rpx;
padding-left: 20rpx;
font-size: 26rpx;
color: #404547;
font-weight: bold;
}
.search-btn {
width: 120rpx;
height: 55rpx;
background: #197adb;
font-size: 26rpx;
color: #ffffff;
margin: 0;
}
}
.uni-table {
display: flex;
flex-direction: column;
width: 100%;
border: 1px solid #ccc;
.iconfont {
transition: all 0.4s ease;
font-size: 32rpx;
}
.uni-tr {
display: flex;
width: 100%;
&.curr {
background-color: #dbfbf0;
.iconfont {
font-size: 35rpx;
color: #197adb;
}
}
& + .uni-tr {
border-top: 1px solid #ccc;
}
}
.uni-th,
.uni-td {
flex: 1;
padding: 8rpx 12rpx;
border-right: 1px solid #ccc;
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
font-size: 28rpx;
&:last-child {
border-right: none;
}
}
.uni-th {
font-weight: bold;
background-color: #f1f1f1;
color: #333;
}
.uni-td {
color: #666;
}
.uni-th:first-child,
.uni-td:first-child {
width: 100rpx;
flex: 0 0 100rpx;
text-align: center;
}
.uni-td:nth-child(2),
.uni-th:nth-child(2),
.uni-td:nth-child(3),
.uni-th:nth-child(3) {
white-space: normal;
word-break: break-word;
}
}
}
.btn {
width: 100%;
.ok {
width: 50%;
height: 60rpx;
background: #197adb;
font-size: 26rpx;
color: #ffffff;
}
.canel {
width: 50%;
height: 60rpx;
background: #ffffff;
border-top: 1px solid #999;
font-size: 24rpx;
color: #999;
}
}
}
...@@ -246,6 +246,28 @@ ...@@ -246,6 +246,28 @@
"style": { "style": {
"navigationBarTitleText": "理货记录" "navigationBarTitleText": "理货记录"
} }
}, {
"path": "pages/tally/abnormalManageList",
"style": {
"navigationBarTitleText": "异常管理",
"app-plus": {
"titleNView": {
"buttons": [{
"index": "0",
"text": "新增异常",
"fontSize": "15px",
"color": "#1969F9",
"float": "right",
"width": "120px"
}]
}
}
}
}, {
"path": "pages/tally/addAbnormal",
"style": {
"navigationBarTitleText": "新增异常"
}
}], }],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
......
...@@ -149,6 +149,11 @@ ...@@ -149,6 +149,11 @@
name: '货品查询', name: '货品查询',
iconfont: 'icon-huopinchaxun', iconfont: 'icon-huopinchaxun',
tips: '' tips: ''
},
{
name: '异常管理',
iconfont: 'icon-a-10cangkucangchu1',
tips: ''
} }
] ]
}; };
...@@ -283,6 +288,10 @@ ...@@ -283,6 +288,10 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/tally/goods' url: '/pages/tally/goods'
}); });
} else if (item.name == '异常管理') {
uni.navigateTo({
url: '/pages/tally/abnormalManageList'
});
} else { } else {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
......
<template>
<view class="page-box">
<!-- 搜索参数 -->
<view class="search-box row bothSide verCenter">
<view class="sn row rowCenter verCenter">
<picker @change="bindPickerChange($event,1)" :value="index" :range="array">
<view class="row verCenter">
<view class="uni-input">{{ array[index] }}</view>
<view class="uni-arrow"></view>
</view>
</picker>
</view>
<view class="search-bar row bothSide verCenter">
<view class="row verCenter" style="width: 100%;">
<text class="iconfont icon-juxing11"></text>
<input class="uni-input" placeholder="输入型号或入仓号或异常编码查询" placeholder-style="color:#919399" :focus="is_focus" v-model="searchParams.keyword" @input="handleInput" style="width: 100%;" />
</view>
<text class="iconfont icon-a-juxing111" @click="clearInput()" v-if="input_flag"></text>
</view>
</view>
<view class="row radio-box">
<radio-group @change="radioChange" class="row verCenter" style="width: 100%;">
<label class="radio row verCenter" style="width: 30%;">
<radio value="0" style="transform:scale(0.7)" color="#197adb" />待业务处理
</label>
<label class="radio row verCenter" style="width: 30%;">
<radio value="1" style="transform:scale(0.7)" color="#197adb" />待仓库确认
</label>
<label class="radio row verCenter" style="width: 20%;">
<radio value="2" style="transform:scale(0.7)" color="#197adb" />已确认
</label>
<label class="radio row verCenter" style="width: 20%;">
<radio value="-1" style="transform:scale(0.7)" color="#197adb" />作废
</label>
</radio-group>
</view>
<view class="total-text" v-if="list.length > 0"><text>{{total}}</text>条数据</view>
<!-- 列表区 -->
<view class="list" v-if="list.length > 0">
<view class="box row" v-for="(item, index) in list" :key="index">
<view class="input-box row verCenter bothSide" style="flex: 0 0 100%;">
<view>
<text class="tt" style="color: #000;font-weight: bold;" @click="open()">{{ item.entrust_no }}</text>
</view>
<view class="row verCenter">
<text class="text" style="color: red;font-weight: bold;">{{ item.abnormal_type_val }}</text>
<text class="text" style="margin-left: 20px;font-weight: bold;">{{ item.abnormal_status_val }}</text>
</view>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">异常编码:</text>
<text class="text">{{item.abnormal_number}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">订单型号:</text>
<text class="text">{{item.order_model}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">实物型号:</text>
<text class="text">{{item.actual_model}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">订单品牌:</text>
<text class="text">{{item.order_brand}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">订单数量:</text>
<text class="text">{{item.order_qty}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">订单产地:</text>
<text class="text">{{item.order_origin}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">异常说明:</text>
<text class="text">{{item.abnormal_explain}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">业务回复:</text>
<text class="text" style="color: red;">{{item.handle_explain}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">创建时间:</text>
<text class="text">{{item.create_time_val}}</text>
</view>
<view class="input-box row verCenter" style="flex: 0 0 100%;">
<text class="label">回复时间:</text>
<text class="text">{{item.salesman_handle_time_val}}</text>
</view>
<view class="input-box row" style="flex: 0 0 100%;">
<text class="label">理货照片:</text>
<view class="pick_img_list row">
<template v-if="item.abnormal_pic_urls.length > 0">
<view class="img_list" v-for="(v, i) in item.abnormal_pic_urls" :key="i">
<image :src="v" mode="aspectFill" @click="previewChange(item.abnormal_pic_urls,i)"></image>
</view>
</template>
</view>
</view>
<view class="btn-box row">
<!-- 除“作废”状态的异常,其他状态异常均可作废 -->
<template v-if="item.abnormal_status != -1">
<view class="btn1 row rowCenter verCenter" @click="cancelAbnormal(item.abnormal_id)">作废</view>
</template>
<!-- 仅“待仓库确认”时可操作 -->
<template v-if="item.abnormal_status == 1">
<view class="btn2 row rowCenter verCenter" @click="confirmAbnormal(item.abnormal_id)">确认</view>
</template>
</view>
</view>
</view>
<!-- 无数据展示 -->
<view class="no-date column rowCenter verCenter" v-else>
<text class="iconfont icon-a-juxing21"></text>
<text class="text">查不到当前数据</text>
</view>
<!-- 新增异常弹窗 -->
<uni-popup ref="popup" background-color="#F1F4F6">
<view class="popup-content">
<view class="section">
<view class="input-box row verCenter" style="margin-bottom: 40rpx;">
<text style="color: red;">*</text>
<text class="label">入仓号:</text>
<input class="uni-input" type="text" placeholder="请输入入仓号" placeholder-style="color:#000;font-weight: bold;" v-model="entrust_no" />
<button class="search-btn row rowCenter verCenter" @click="search()">搜索</button>
</view>
<view class="uni-table" v-if="orderDetailByIdList.length > 0">
<view class="uni-tr">
<view class="uni-th">序号</view>
<view class="uni-th">型号</view>
<view class="uni-th">品牌</view>
<view class="uni-th">数量</view>
</view>
<view class="uni-tr" v-for="(item,index) in orderDetailByIdList" :key="index" @click="selectedChange(2,index)" :class="{curr:orderDetailByIdIndex==index}">
<view class="uni-td">{{index+1}}</view>
<view class="uni-td">{{item.model}}</view>
<view class="uni-td">{{item.brand}}</view>
<view class="uni-td">{{item.qty}}</view>
</view>
</view>
</view>
<view class="btn row bothSide">
<view class="canel row rowCenter verCenter" @click="close()">返回</view>
<view class="ok row rowCenter verCenter" @click="next()">下一步</view>
</view>
</view>
</uni-popup>
<!-- 多个入仓号 -->
<uni-popup ref="popupErpSn" background-color="#F1F4F6">
<view class="popup-content">
<view class="section">
<view style="margin-bottom: 20rpx;">
<text style="color: #1969f9;">{{entrust_no}}</text>
<text>有相似入仓号订单,请选择</text>
</view>
<view class="uni-table" v-if="allOrderDataByEntrustNoList.length > 0">
<view class="uni-tr">
<view class="uni-th" style="text-align: center;"></view>
<view class="uni-th" style="text-align: center;">入仓单号</view>
<view class="uni-th" style="text-align: center;">明细数</view>
<view class="uni-th" style="text-align: center;">入库状态</view>
</view>
<view class="uni-tr" v-for="(item,index) in allOrderDataByEntrustNoList" :key="index" @click="selectedChange(1,index)" :class="{curr:allOrderDataByEntrustNoIndex==index}">
<view class="uni-td" style="text-align: center;">
<template v-if="allOrderDataByEntrustNoIndex==index">
<text class="iconfont icon-danxuankuangdanxuan-xuanzhong-weixuanzhong"></text>
</template>
<template v-else>
<text class="iconfont icon-danxuanxuanzhong-weixuanzhong"></text>
</template>
</view>
<view class="uni-td" style="text-align: center;">{{item.erp_order_sn}}</view>
<view class="uni-td" style="text-align: center;">{{item.detail_count}}</view>
<view class="uni-td" style="text-align: center;">{{item.stock_in_status_val}}</view>
</view>
</view>
</view>
<view class="btn row bothSide">
<view class="canel row rowCenter verCenter" @click="close(1)">关闭</view>
<view class="ok row rowCenter verCenter" @click="close(2)">确定</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { API } from '@/util/api.js';
import debounce from 'lodash/debounce';
export default {
data() {
return {
page: 1,
limit: 30,
list: [],
index: 0,
array: ['全量搜索'],
detail: {}, //详情
input_flag: false,
entrust_no: '', //入仓号
total: 0,
is_focus: true, //获取焦点动态化
hasMoreData: true, //是否分页加载
orderDetailByIdList: [],
orderDetailByIdIndex: -1,
allOrderDataByEntrustNoList: [],
allOrderDataByEntrustNoIndex: -1,
order_id: '',
searchParams: {
keyword: ''
}
};
},
onReachBottom() {
if (!this.hasMoreData) {
return;
}
this.page++;
this.getData();
},
onNavigationBarButtonTap(e) {
if (e.index == 0) {
}
},
onShow() {
this.getData();
this.$refs.popup.open();
},
methods: {
/**
* td选中
* @param {Object} type
* @param {Object} index
*/
selectedChange(type, index) {
if (type == 1) {
this.allOrderDataByEntrustNoIndex = index;
} else if (type == 2) {
this.orderDetailByIdIndex = index;
}
},
radioChange: function(e) {
var value = e.detail.value;
console.log(value)
},
getData() {
this.request(API.abnormalManageList, 'GET', { page: this.page, limit: this.limit, ...this.searchParams }, true).then(res => {
if (res.err_code === 0) {
this.total = res.data.total;
if (res.data.data.length > 0) {
this.hasMoreData = true;
this.list = this.list.concat(res.data.data);
} else {
this.hasMoreData = false;
}
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 预览图片
* @param {Object} img
* @param {Object} index
*/
previewChange(arr, index) {
this.noexebshowFalg = false;
uni.previewImage({
current: index,
urls: arr
});
},
/**
* 全量搜索
* @param {Object} event
*/
handleInput: debounce(function(event) {
this.resetChange();
var val = event.target.value;
this.searchParams.keyword = '';
if (val) {
this.searchParams.keyword = val;
this.input_flag = true;
} else {
this.input_flag = false;
}
this.getData();
}, 500),
/**
* 清空数据
*/
clearInput(type) {
this.resetChange();
if (type == 'start') {
//清除起始时间
this.searchParams.create_time_begin = '';
this.getData();
} else if (type == 'end') {
//清除结束时间
this.searchParams.create_time_end = '';
this.getData();
} else {
this.searchParams.keyword = '';
this.input_flag = false;
this.clearInputAndFocus();
this.getData();
}
},
/**
* 重置
*/
resetChange() {
this.list = [];
this.page = 1;
},
/**
* 再次获取焦点
*/
clearInputAndFocus() {
this.input_flag = false; //关闭叉叉
this.is_focus = false;
setTimeout(() => {
this.is_focus = true;
}, 200);
},
/**
* 入仓号进行模糊查询
*/
getAllOrderDataByEntrustNo() {
this.request(API.getAllOrderDataByEntrustNo, 'GET', { entrust_no: this.entrust_no }, true).then(res => {
if (res.err_code === 0) {
if (res.data.length > 0) {
if (res.data.length == 1) {
this.getOrderDetailById(res.data[0].order_id);
} else {
this.allOrderDataByEntrustNoList = res.data;
this.open(1);
}
} else {
uni.showToast({
title: '暂无该入仓号数据',
icon: 'none'
});
}
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 根据订单ID获取明细
*/
getOrderDetailById(order_id) {
this.request(API.getOrderDetailById, 'GET', { order_id: order_id }, true).then(res => {
if (res.err_code === 0) {
this.order_id = order_id;
this.orderDetailByIdList = [];
this.orderDetailByIdList = res.data;
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
},
/**
* 打开弹窗
*/
open(type) {
if (type == 1) {
this.$refs.popupErpSn.open();
} else {
this.$refs.popup.open();
}
},
/**
* 关闭弹窗
*/
close(type) {
if (type == 1) {
this.$refs.popupErpSn.close();
} else if (type == 2) {
if (this.allOrderDataByEntrustNoIndex == -1) {
uni.showToast({
title: '请选择入仓号',
icon: 'none'
});
return false;
}
this.getOrderDetailById(this.allOrderDataByEntrustNoList[this.allOrderDataByEntrustNoIndex].order_id);
this.$refs.popupErpSn.close();
} else {
this.$refs.popup.close();
}
},
/**
* 搜索
*/
search() {
if (this.entrust_no.length < 3) {
uni.showToast({
title: '入仓号至少输入三个字符',
icon: 'none'
});
return false;
}
this.getAllOrderDataByEntrustNo();
},
/**
* 下一步
*/
next() {
if (!this.entrust_no) {
uni.showToast({
title: '请输入入仓号',
icon: 'none'
});
return false;
}
if (this.orderDetailByIdIndex == -1) {
uni.showToast({
title: '请选择异常数据',
icon: 'none'
});
return false;
}
let erp_order_sn = this.allOrderDataByEntrustNoList[this.allOrderDataByEntrustNoIndex].erp_order_sn;
let salesman = this.allOrderDataByEntrustNoList[this.allOrderDataByEntrustNoIndex].salesman;
uni.navigateTo({
url: '/pages/tally/addAbnormal?order_id=' + this.order_id + '&erp_order_sn=' + erp_order_sn + '&salesman=' + salesman + '&orderDetailByIdIndex=' + this.orderDetailByIdIndex
})
},
/**
* 异常作废
*/
cancelAbnormal(abnormal_id) {
uni.showModal({
title: '提示',
content: '是否确认作废该异常?',
success: (res) => {
if (res.confirm) {
this.request(API.cancelAbnormal, 'GET', { abnormal_id: abnormal_id }, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '操作成功',
icon: 'success',
duration: 1000
});
setTimeout(() => {
this.getData();
}, 1000)
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
/**
* 异常确认
*/
confirmAbnormal(abnormal_id) {
uni.showModal({
title: '提示',
content: '是否确认业务处理方案?',
success: (res) => {
if (res.confirm) {
this.request(API.confirmAbnormal, 'GET', { abnormal_id: abnormal_id }, true).then(res => {
if (res.err_code === 0) {
uni.showToast({
title: '确认成功',
icon: 'success',
duration: 1000
});
setTimeout(() => {
this.getData();
}, 1000)
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
}
};
</script>
<style scoped lang="scss">
@import '@/assets/css/tally/abnormalManageList.scss';
</style>
\ No newline at end of file
<template>
<view class="page-box">
</view>
</template>
<script>
import { API } from '@/util/api.js';
export default {
data() {
return {
order_id: '',
erp_order_sn: '',
salesman: '',
orderDetailByIdIndex: '',
orderDetailByIdList: {},
quickExpressions: {}
};
},
onLoad(options) {
this.order_id = options.order_id;
this.erp_order_sn = options.erp_order_sn;
this.salesman = options.salesman;
this.orderDetailByIdIndex = options.orderDetailByIdIndex;
},
onShow() {
this.getData();
},
methods: {
getData() {
this.request(API.getOrderDetailById, 'GET', { order_id: this.order_id }, true).then(res => {
if (res.err_code === 0) {
this.orderDetailByIdList = res.data[this.orderDetailByIdIndex];
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
this.request(API.getQuickExpressions, 'GET', { abnormal_type: 1 }, true).then(res => {
if (res.err_code === 0) {
this.quickExpressions = res.data;
} else {
uni.showToast({
title: res.err_msg,
icon: 'none'
});
}
});
}
}
};
</script>
<style scoped lang="scss">
@import '@/assets/css/tally/addAbnormal.scss';
</style>
\ No newline at end of file
No preview for this file type
## 2.2.34(2024-04-24)
- 新增 日期点击事件,在点击日期时会触发该事件。
## 2.2.33(2024-04-15)
- 修复 抖音小程序事件传递失效bug
## 2.2.32(2024-02-20)
- 修复 日历的close事件触发异常的bug [详情](https://github.com/dcloudio/uni-ui/issues/844)
## 2.2.31(2024-02-20)
- 修复 h5平台 右边日历的月份默认+1的bug [详情](https://github.com/dcloudio/uni-ui/issues/841)
## 2.2.30(2024-01-31)
- 修复 隐藏“秒”时,在IOS15及以下版本时出现 结束时间在开始时间之前 的bug [详情](https://github.com/dcloudio/uni-ui/issues/788)
## 2.2.29(2024-01-20)
- 新增 show事件,弹窗弹出时触发该事件 [详情](https://github.com/dcloudio/uni-app/issues/4694)
## 2.2.28(2024-01-18)
- 去除 noChange事件,当进行日期范围选择时,若只选了一天,则开始结束日期都为同一天 [详情](https://github.com/dcloudio/uni-ui/issues/815)
## 2.2.27(2024-01-10)
- 优化 增加noChange事件,当进行日期范围选择时,若有空值,则触发该事件 [详情](https://github.com/dcloudio/uni-ui/issues/815)
## 2.2.26(2024-01-08)
- 修复 字节小程序时间选择范围器失效问题 [详情](https://github.com/dcloudio/uni-ui/issues/834)
## 2.2.25(2023-10-18)
- 修复 PC端初次修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737)
## 2.2.24(2023-06-02)
- 修复 部分情况修改时间,开始、结束时间显示异常的Bug [详情](https://ask.dcloud.net.cn/question/171146)
- 优化 当前月可以选择上月、下月的日期的Bug
## 2.2.23(2023-05-02)
- 修复 部分情况修改时间,开始时间未更新的Bug [详情](https://github.com/dcloudio/uni-ui/issues/737)
- 修复 部分平台及设备第一次点击无法显示弹框的Bug
- 修复 ios 日期格式未补零显示及使用异常的Bug [详情](https://ask.dcloud.net.cn/question/162979)
## 2.2.22(2023-03-30)
- 修复 日历 picker 修改年月后,自动选中当月1日的Bug [详情](https://ask.dcloud.net.cn/question/165937)
- 修复 小程序端 低版本 ios NaN的Bug [详情](https://ask.dcloud.net.cn/question/162979)
## 2.2.21(2023-02-20)
- 修复 firefox 浏览器显示区域点击无法拉起日历弹框的Bug [详情](https://ask.dcloud.net.cn/question/163362)
## 2.2.20(2023-02-17)
- 优化 值为空依然选中当天问题
- 优化 提供 default-value 属性支持配置选择器打开时默认显示的时间
- 优化 非范围选择未选择日期时间,点击确认按钮选中当前日期时间
- 优化 字节小程序日期时间范围选择,底部日期换行的Bug
## 2.2.19(2023-02-09)
- 修复 2.2.18 引起范围选择配置 end 选择无效的Bug [详情](https://github.com/dcloudio/uni-ui/issues/686)
## 2.2.18(2023-02-08)
- 修复 移动端范围选择change事件触发异常的Bug [详情](https://github.com/dcloudio/uni-ui/issues/684)
- 优化 PC端输入日期格式错误时返回当前日期时间
- 优化 PC端输入日期时间超出 start、end 限制的Bug
- 优化 移动端日期时间范围用法时间展示不完整问题
## 2.2.17(2023-02-04)
- 修复 小程序端绑定 Date 类型报错的Bug [详情](https://github.com/dcloudio/uni-ui/issues/679)
- 修复 vue3 time-picker 无法显示绑定时分秒的Bug
## 2.2.16(2023-02-02)
- 修复 字节小程序报错的Bug
## 2.2.15(2023-02-02)
- 修复 某些情况切换月份错误的Bug
## 2.2.14(2023-01-30)
- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/162033)
## 2.2.13(2023-01-10)
- 修复 多次加载组件造成内存占用的Bug
## 2.2.12(2022-12-01)
- 修复 vue3 下 i18n 国际化初始值不正确的Bug
## 2.2.11(2022-09-19)
- 修复 支付宝小程序样式错乱的Bug [详情](https://github.com/dcloudio/uni-app/issues/3861)
## 2.2.10(2022-09-19)
- 修复 反向选择日期范围,日期显示异常的Bug [详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false)
## 2.2.9(2022-09-16)
- 可以使用 uni-scss 控制主题色
## 2.2.8(2022-09-08)
- 修复 close事件无效的Bug
## 2.2.7(2022-09-05)
- 修复 移动端 maskClick 无效的Bug [详情](https://ask.dcloud.net.cn/question/140824)
## 2.2.6(2022-06-30) ## 2.2.6(2022-06-30)
- 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致 - 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致
## 2.2.5(2022-06-24) ## 2.2.5(2022-06-24)
- 修复 日历顶部年月及底部确认未国际化 bug - 修复 日历顶部年月及底部确认未国际化的Bug
## 2.2.4(2022-03-31) ## 2.2.4(2022-03-31)
- 修复 Vue3 下动态赋值,单选类型未响应的 bug - 修复 Vue3 下动态赋值,单选类型未响应的Bug
## 2.2.3(2022-03-28) ## 2.2.3(2022-03-28)
- 修复 Vue3 下动态赋值未响应的 bug - 修复 Vue3 下动态赋值未响应的Bug
## 2.2.2(2021-12-10) ## 2.2.2(2021-12-10)
- 修复 clear-icon 属性在小程序平台不生效的 bug - 修复 clear-icon 属性在小程序平台不生效的Bug
## 2.2.1(2021-12-10) ## 2.2.1(2021-12-10)
- 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的 bug - 修复 日期范围选在小程序平台,必须多点击一次才能取消选中状态的Bug
## 2.2.0(2021-11-19) ## 2.2.0(2021-11-19)
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) - 优化 组件UI,并提供设计资源 [详情](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker) - 文档迁移 [https://uniapp.dcloud.io/component/uniui/uni-datetime-picker](https://uniapp.dcloud.io/component/uniui/uni-datetime-picker)
## 2.1.5(2021-11-09) ## 2.1.5(2021-11-09)
- 新增 提供组件设计资源,组件样式调整 - 新增 提供组件设计资源,组件样式调整
## 2.1.4(2021-09-10) ## 2.1.4(2021-09-10)
- 修复 hide-second 在移动端的 bug - 修复 hide-second 在移动端的Bug
- 修复 单选赋默认值时,赋值日期未高亮的 bug - 修复 单选赋默认值时,赋值日期未高亮的Bug
- 修复 赋默认值时,移动端未正确显示时间的 bug - 修复 赋默认值时,移动端未正确显示时间的Bug
## 2.1.3(2021-09-09) ## 2.1.3(2021-09-09)
- 新增 hide-second 属性,支持只使用时分,隐藏秒 - 新增 hide-second 属性,支持只使用时分,隐藏秒
## 2.1.2(2021-09-03) ## 2.1.2(2021-09-03)
- 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次 - 优化 取消选中时(范围选)直接开始下一次选择, 避免多点一次
- 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法 - 优化 移动端支持清除按钮,同时支持通过 ref 调用组件的 clear 方法
- 优化 调整字号大小,美化日历界面 - 优化 调整字号大小,美化日历界面
- 修复 因国际化导致的 placeholder 失效的 bug - 修复 因国际化导致的 placeholder 失效的Bug
## 2.1.1(2021-08-24) ## 2.1.1(2021-08-24)
- 新增 支持国际化 - 新增 支持国际化
- 优化 范围选择器在 pc 端过宽的问题 - 优化 范围选择器在 pc 端过宽的问题
...@@ -33,50 +100,50 @@ ...@@ -33,50 +100,50 @@
- 新增 适配 vue3 - 新增 适配 vue3
## 2.0.19(2021-08-09) ## 2.0.19(2021-08-09)
- 新增 支持作为 uni-forms 子组件相关功能 - 新增 支持作为 uni-forms 子组件相关功能
- 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的 bug - 修复 在 uni-forms 中使用时,选择时间报 NAN 错误的Bug
## 2.0.18(2021-08-05) ## 2.0.18(2021-08-05)
- 修复 type 属性动态赋值无效的 bug - 修复 type 属性动态赋值无效的Bug
- 修复 ‘确认’按钮被 tabbar 遮盖 bug - 修复 ‘确认’按钮被 tabbar 遮盖 bug
- 修复 组件未赋值时范围选左、右日历相同的 bug - 修复 组件未赋值时范围选左、右日历相同的Bug
## 2.0.17(2021-08-04) ## 2.0.17(2021-08-04)
- 修复 范围选未正确显示当前值的 bug - 修复 范围选未正确显示当前值的Bug
- 修复 h5 平台(移动端)报错 'cale' of undefined 的 bug - 修复 h5 平台(移动端)报错 'cale' of undefined 的Bug
## 2.0.16(2021-07-21) ## 2.0.16(2021-07-21)
- 新增 return-type 属性支持返回 date 日期对象 - 新增 return-type 属性支持返回 date 日期对象
## 2.0.15(2021-07-14) ## 2.0.15(2021-07-14)
- 修复 单选日期类型,初始赋值后不在当前日历的 bug - 修复 单选日期类型,初始赋值后不在当前日历的Bug
- 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效) - 新增 clearIcon 属性,显示框的清空按钮可配置显示隐藏(仅 pc 有效)
- 优化 移动端移除显示框的清空按钮,无实际用途 - 优化 移动端移除显示框的清空按钮,无实际用途
## 2.0.14(2021-07-14) ## 2.0.14(2021-07-14)
- 修复 组件赋值为空,界面未更新的 bug - 修复 组件赋值为空,界面未更新的Bug
- 修复 start 和 end 不能动态赋值的 bug - 修复 start 和 end 不能动态赋值的Bug
- 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的 bug - 修复 范围选类型,用户选择后再次选择右侧日历(结束日期)显示不正确的Bug
## 2.0.13(2021-07-08) ## 2.0.13(2021-07-08)
- 修复 范围选择不能动态赋值的 bug - 修复 范围选择不能动态赋值的Bug
## 2.0.12(2021-07-08) ## 2.0.12(2021-07-08)
- 修复 范围选择的初始时间在一个月内时,造成无法选择的bug - 修复 范围选择的初始时间在一个月内时,造成无法选择的bug
## 2.0.11(2021-07-08) ## 2.0.11(2021-07-08)
- 优化 弹出层在超出视窗边缘定位不准确的问题 - 优化 弹出层在超出视窗边缘定位不准确的问题
## 2.0.10(2021-07-08) ## 2.0.10(2021-07-08)
- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug - 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的Bug
- 优化 弹出层在超出视窗边缘被遮盖的问题 - 优化 弹出层在超出视窗边缘被遮盖的问题
## 2.0.9(2021-07-07) ## 2.0.9(2021-07-07)
- 新增 maskClick 事件 - 新增 maskClick 事件
- 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px - 修复 特殊情况日历 rpx 布局错误的Bug,rpx -> px
- 修复 范围选择时清空返回值不合理的bug,['', ''] -> [] - 修复 范围选择时清空返回值不合理的bug,['', ''] -> []
## 2.0.8(2021-07-07) ## 2.0.8(2021-07-07)
- 新增 日期时间显示框支持插槽 - 新增 日期时间显示框支持插槽
## 2.0.7(2021-07-01) ## 2.0.7(2021-07-01)
- 优化 添加 uni-icons 依赖 - 优化 添加 uni-icons 依赖
## 2.0.6(2021-05-22) ## 2.0.6(2021-05-22)
- 修复 图标在小程序上不显示的 bug - 修复 图标在小程序上不显示的Bug
- 优化 重命名引用组件,避免潜在组件命名冲突 - 优化 重命名引用组件,避免潜在组件命名冲突
## 2.0.5(2021-05-20) ## 2.0.5(2021-05-20)
- 优化 代码目录扁平化 - 优化 代码目录扁平化
## 2.0.4(2021-05-12) ## 2.0.4(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 2.0.3(2021-05-10) ## 2.0.3(2021-05-10)
- 修复 ios 下不识别 '-' 日期格式的 bug - 修复 ios 下不识别 '-' 日期格式的Bug
- 优化 pc 下弹出层添加边框和阴影 - 优化 pc 下弹出层添加边框和阴影
## 2.0.2(2021-05-08) ## 2.0.2(2021-05-08)
- 修复 在 admin 中获取弹出层定位错误的bug - 修复 在 admin 中获取弹出层定位错误的bug
...@@ -87,7 +154,7 @@ ...@@ -87,7 +154,7 @@
> 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker) > 注意:此版本不向后兼容,不再支持单独时间选择(type=time)及相关的 hide-second 属性(时间选可使用内置组件 picker)
## 1.0.6(2021-03-18) ## 1.0.6(2021-03-18)
- 新增 hide-second 属性,时间支持仅选择时、分 - 新增 hide-second 属性,时间支持仅选择时、分
- 修复 选择跟显示的日期不一样的 bug - 修复 选择跟显示的日期不一样的Bug
- 修复 chang事件触发2次的 bug - 修复 chang事件触发2次的Bug
- 修复 分、秒 end 范围错误的 bug - 修复 分、秒 end 范围错误的Bug
- 优化 更好的 nvue 适配 - 优化 更好的 nvue 适配
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
'uni-calendar-item--after-checked':weeks.afterMultiple, 'uni-calendar-item--after-checked':weeks.afterMultiple,
'uni-calendar-item--disable':weeks.disable, 'uni-calendar-item--disable':weeks.disable,
}"> }">
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text> <text v-if="selected && weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
<text class="uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text">{{weeks.date}}</text> <text class="uni-calendar-item__weeks-box-text uni-calendar-item__weeks-box-text-disable uni-calendar-item--checked-text">{{weeks.date}}</text>
</view> </view>
<view :class="{'uni-calendar-item--isDay': weeks.isDay}"></view> <view :class="{'uni-calendar-item--today': weeks.isToday}"></view>
</view> </view>
</template> </template>
...@@ -41,10 +41,6 @@ ...@@ -41,10 +41,6 @@
return [] return []
} }
}, },
lunar: {
type: Boolean,
default: false
},
checkHover: { checkHover: {
type: Boolean, type: Boolean,
default: false default: false
...@@ -62,6 +58,8 @@ ...@@ -62,6 +58,8 @@
</script> </script>
<style lang="scss" > <style lang="scss" >
$uni-primary: #007aff !default;
.uni-calendar-item__weeks-box { .uni-calendar-item__weeks-box {
flex: 1; flex: 1;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
...@@ -78,12 +76,7 @@ ...@@ -78,12 +76,7 @@
font-size: 14px; font-size: 14px;
// font-family: Lato-Bold, Lato; // font-family: Lato-Bold, Lato;
font-weight: bold; font-weight: bold;
color: #455997; color: darken($color: $uni-primary, $amount: 40%);
}
.uni-calendar-item__weeks-lunar-text {
font-size: 12px;
color: #333;
} }
.uni-calendar-item__weeks-box-item { .uni-calendar-item__weeks-box-item {
...@@ -114,7 +107,6 @@ ...@@ -114,7 +107,6 @@
} }
.uni-calendar-item__weeks-box .uni-calendar-item--disable { .uni-calendar-item__weeks-box .uni-calendar-item--disable {
// background-color: rgba(249, 249, 249, $uni-opacity-disabled);
cursor: default; cursor: default;
} }
...@@ -122,7 +114,7 @@ ...@@ -122,7 +114,7 @@
color: #D1D1D1; color: #D1D1D1;
} }
.uni-calendar-item--isDay { .uni-calendar-item--today {
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 17%; right: 17%;
...@@ -138,7 +130,7 @@ ...@@ -138,7 +130,7 @@
} }
.uni-calendar-item__weeks-box .uni-calendar-item--checked { .uni-calendar-item__weeks-box .uni-calendar-item--checked {
background-color: #007aff; background-color: $uni-primary;
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
border: 3px solid #fff; border: 3px solid #fff;
...@@ -159,7 +151,7 @@ ...@@ -159,7 +151,7 @@
.uni-calendar-item--multiple .uni-calendar-item--before-checked, .uni-calendar-item--multiple .uni-calendar-item--before-checked,
.uni-calendar-item--multiple .uni-calendar-item--after-checked { .uni-calendar-item--multiple .uni-calendar-item--after-checked {
background-color: #409eff; background-color: $uni-primary;
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
border: 3px solid #F6F7FC; border: 3px solid #F6F7FC;
......
<template> <template>
<view class="uni-calendar" @mouseleave="leaveCale"> <view class="uni-calendar" @mouseleave="leaveCale">
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}"
@click="clean"></view> <view v-if="!insert && show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}"
@click="maskClick"></view>
<view v-if="insert || show" class="uni-calendar__content" <view v-if="insert || show" class="uni-calendar__content"
:class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}"> :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}">
<view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}"> <view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}">
<view v-if="left" class="uni-calendar__header-btn-box" @click.stop="pre">
<view class="uni-calendar__header-btn-box" @click.stop="changeMonth('pre')">
<view class="uni-calendar__header-btn uni-calendar--left"></view> <view class="uni-calendar__header-btn uni-calendar--left"></view>
</view> </view>
<picker mode="date" :value="date" fields="month" @change="bindDateChange"> <picker mode="date" :value="date" fields="month" @change="bindDateChange">
<text <text
class="uni-calendar__header-text">{{ (nowDate.year||'') + yearText + ( nowDate.month||'') + monthText}}</text> class="uni-calendar__header-text">{{ (nowDate.year||'') + yearText + ( nowDate.month||'') + monthText}}</text>
</picker> </picker>
<view v-if="right" class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn-box" @click.stop="changeMonth('next')">
<view class="uni-calendar__header-btn uni-calendar--right"></view> <view class="uni-calendar__header-btn uni-calendar--right"></view>
</view> </view>
<view v-if="!insert" class="dialog-close" @click="clean">
<view v-if="!insert" class="dialog-close" @click="maskClick">
<view class="dialog-close-plus" data-id="close"></view> <view class="dialog-close-plus" data-id="close"></view>
<view class="dialog-close-plus dialog-close-rotate" data-id="close"></view> <view class="dialog-close-plus dialog-close-rotate" data-id="close"></view>
</view> </view>
<!-- <text class="uni-calendar__backtoday" @click="backtoday">回到今天</text> -->
</view> </view>
<view class="uni-calendar__box"> <view class="uni-calendar__box">
<view v-if="showMonth" class="uni-calendar__box-bg"> <view v-if="showMonth" class="uni-calendar__box-bg">
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text> <text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
</view> </view>
<view class="uni-calendar__weeks" style="padding-bottom: 7px;"> <view class="uni-calendar__weeks" style="padding-bottom: 7px;">
<view class="uni-calendar__weeks-day"> <view class="uni-calendar__weeks-day">
<text class="uni-calendar__weeks-day-text">{{SUNText}}</text> <text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
...@@ -49,43 +55,44 @@ ...@@ -49,43 +55,44 @@
<text class="uni-calendar__weeks-day-text">{{SATText}}</text> <text class="uni-calendar__weeks-day-text">{{SATText}}</text>
</view> </view>
</view> </view>
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex"> <view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex"> <view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" <calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected"
:selected="selected" :lunar="lunar" :checkHover="range" @change="choiceDate" :checkHover="range" @change="choiceDate" @handleMouse="handleMouse">
@handleMouse="handleMouse">
</calendar-item> </calendar-item>
</view> </view>
</view> </view>
</view> </view>
<view v-if="!insert && !range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top"
<view v-if="!insert && !range && hasTime" class="uni-date-changed uni-calendar--fixed-top"
style="padding: 0 80px;"> style="padding: 0 80px;">
<view class="uni-date-changed--time-date">{{tempSingleDate ? tempSingleDate : selectDateText}}</view> <view class="uni-date-changed--time-date">{{tempSingleDate ? tempSingleDate : selectDateText}}</view>
<time-picker type="time" :start="reactStartTime" :end="reactEndTime" v-model="time" <time-picker type="time" :start="timepickerStartTime" :end="timepickerEndTime" v-model="time"
:disabled="!tempSingleDate" :border="false" :hide-second="hideSecond" class="time-picker-style"> :disabled="!tempSingleDate" :border="false" :hide-second="hideSecond" class="time-picker-style">
</time-picker> </time-picker>
</view> </view>
<view v-if="!insert && range && typeHasTime" class="uni-date-changed uni-calendar--fixed-top"> <view v-if="!insert && range && hasTime" class="uni-date-changed uni-calendar--fixed-top">
<view class="uni-date-changed--time-start"> <view class="uni-date-changed--time-start">
<view class="uni-date-changed--time-date">{{tempRange.before ? tempRange.before : startDateText}} <view class="uni-date-changed--time-date">{{tempRange.before ? tempRange.before : startDateText}}
</view> </view>
<time-picker type="time" :start="reactStartTime" v-model="timeRange.startTime" :border="false" <time-picker type="time" :start="timepickerStartTime" v-model="timeRange.startTime" :border="false"
:hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style"> :hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style">
</time-picker> </time-picker>
</view> </view>
<uni-icons type="arrowthinright" color="#999" style="line-height: 50px;"></uni-icons> <view style="line-height: 50px;">
<uni-icons type="arrowthinright" color="#999"></uni-icons>
</view>
<view class="uni-date-changed--time-end"> <view class="uni-date-changed--time-end">
<view class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view> <view class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view>
<time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false" <time-picker type="time" :end="timepickerEndTime" v-model="timeRange.endTime" :border="false"
:hide-second="hideSecond" :disabled="!tempRange.after" class="time-picker-style"> :hide-second="hideSecond" :disabled="!tempRange.after" class="time-picker-style">
</time-picker> </time-picker>
</view> </view>
</view> </view>
<view v-if="!insert" class="uni-date-changed uni-date-btn--ok"> <view v-if="!insert" class="uni-date-changed uni-date-btn--ok">
<!-- <view class="uni-calendar__header-btn-box">
<text class="uni-calendar__button-text uni-calendar--fixed-width">{{okText}}</text>
</view> -->
<view class="uni-datetime-picker--btn" @click="confirm">{{confirmText}}</view> <view class="uni-datetime-picker--btn" @click="confirm">{{confirmText}}</view>
</view> </view>
</view> </view>
...@@ -93,22 +100,27 @@ ...@@ -93,22 +100,27 @@
</template> </template>
<script> <script>
import Calendar from './util.js'; import {
Calendar,
getDate,
getTime
} from './util.js';
import calendarItem from './calendar-item.vue' import calendarItem from './calendar-item.vue'
import timePicker from './time-picker.vue' import timePicker from './time-picker.vue'
import { import {
initVueI18n initVueI18n
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import messages from './i18n/index.js' import i18nMessages from './i18n/index.js'
const { const {
t t
} = initVueI18n(messages) } = initVueI18n(i18nMessages)
/** /**
* Calendar 日历 * Calendar 日历
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等 * @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
* @tutorial https://ext.dcloud.net.cn/plugin?id=56 * @tutorial https://ext.dcloud.net.cn/plugin?id=56
* @property {String} date 自定义当前时间,默认为今天 * @property {String} date 自定义当前时间,默认为今天
* @property {Boolean} lunar 显示农历
* @property {String} startDate 日期选择范围-开始日期 * @property {String} startDate 日期选择范围-开始日期
* @property {String} endDate 日期选择范围-结束日期 * @property {String} endDate 日期选择范围-结束日期
* @property {Boolean} range 范围选择 * @property {Boolean} range 范围选择
...@@ -118,16 +130,26 @@ ...@@ -118,16 +130,26 @@
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容 * @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] * @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
* @property {Boolean} showMonth 是否选择月份为背景 * @property {Boolean} showMonth 是否选择月份为背景
* @property {[String} defaultValue 选择器打开时默认显示的时间
* @event {Function} change 日期改变,`insert :ture` 时生效 * @event {Function} change 日期改变,`insert :ture` 时生效
* @event {Function} confirm 确认选择`insert :false` 时生效 * @event {Function} confirm 确认选择`insert :false` 时生效
* @event {Function} monthSwitch 切换月份时触发 * @event {Function} monthSwitch 切换月份时触发
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" /> * @example <uni-calendar :insert="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
*/ */
export default { export default {
components: { components: {
calendarItem, calendarItem,
timePicker timePicker
}, },
options: {
// #ifdef MP-TOUTIAO
virtualHost: false,
// #endif
// #ifndef MP-TOUTIAO
virtualHost: true
// #endif
},
props: { props: {
date: { date: {
type: String, type: String,
...@@ -149,10 +171,6 @@ ...@@ -149,10 +171,6 @@
return [] return []
} }
}, },
lunar: {
type: Boolean,
default: false
},
startDate: { startDate: {
type: String, type: String,
default: '' default: ''
...@@ -161,11 +179,19 @@ ...@@ -161,11 +179,19 @@
type: String, type: String,
default: '' default: ''
}, },
startPlaceholder: {
type: String,
default: ''
},
endPlaceholder: {
type: String,
default: ''
},
range: { range: {
type: Boolean, type: Boolean,
default: false default: false
}, },
typeHasTime: { hasTime: {
type: Boolean, type: Boolean,
default: false default: false
}, },
...@@ -181,14 +207,6 @@ ...@@ -181,14 +207,6 @@
type: Boolean, type: Boolean,
default: true default: true
}, },
left: {
type: Boolean,
default: true
},
right: {
type: Boolean,
default: true
},
checkHover: { checkHover: {
type: Boolean, type: Boolean,
default: true default: true
...@@ -207,6 +225,10 @@ ...@@ -207,6 +225,10 @@
fulldate: '' fulldate: ''
} }
} }
},
defaultValue: {
type: [String, Object, Array],
default: ''
} }
}, },
data() { data() {
...@@ -214,7 +236,7 @@ ...@@ -214,7 +236,7 @@
show: false, show: false,
weeks: [], weeks: [],
calendar: {}, calendar: {},
nowDate: '', nowDate: {},
aniMaskShow: false, aniMaskShow: false,
firstEnter: true, firstEnter: true,
time: '', time: '',
...@@ -232,7 +254,7 @@ ...@@ -232,7 +254,7 @@
watch: { watch: {
date: { date: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
if (!this.range) { if (!this.range) {
this.tempSingleDate = newVal this.tempSingleDate = newVal
setTimeout(() => { setTimeout(() => {
...@@ -243,33 +265,44 @@ ...@@ -243,33 +265,44 @@
}, },
defTime: { defTime: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
if (!this.range) { if (!this.range) {
this.time = newVal this.time = newVal
} else { } else {
// console.log('-----', newVal);
this.timeRange.startTime = newVal.start this.timeRange.startTime = newVal.start
this.timeRange.endTime = newVal.end this.timeRange.endTime = newVal.end
} }
} }
}, },
startDate(val) { startDate(val) {
this.cale.resetSatrtDate(val) // 字节小程序 watch 早于 created
if (!this.cale) {
return
}
this.cale.setStartDate(val)
this.cale.setDate(this.nowDate.fullDate) this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
}, },
endDate(val) { endDate(val) {
this.cale.resetEndDate(val) // 字节小程序 watch 早于 created
if (!this.cale) {
return
}
this.cale.setEndDate(val)
this.cale.setDate(this.nowDate.fullDate) this.cale.setDate(this.nowDate.fullDate)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
}, },
selected(newVal) { selected(newVal) {
// 字节小程序 watch 早于 created
if (!this.cale) {
return
}
this.cale.setSelectInfo(this.nowDate.fullDate, newVal) this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
}, },
pleStatus: { pleStatus: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
const { const {
before, before,
after, after,
...@@ -292,11 +325,16 @@ ...@@ -292,11 +325,16 @@
this.cale.lastHover = false this.cale.lastHover = false
} }
} else { } else {
// 字节小程序 watch 早于 created
if (!this.cale) {
return
}
this.cale.setDefaultMultiple(before, after) this.cale.setDefaultMultiple(before, after)
if (which === 'left') { if (which === 'left' && before) {
this.setDate(before) this.setDate(before)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
} else { } else if (after) {
this.setDate(after) this.setDate(after)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
} }
...@@ -307,15 +345,13 @@ ...@@ -307,15 +345,13 @@
} }
}, },
computed: { computed: {
reactStartTime() { timepickerStartTime() {
const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate const activeDate = this.range ? this.tempRange.before : this.calendar.fullDate
const res = activeDate === this.startDate ? this.selectableTimes.start : '' return activeDate === this.startDate ? this.selectableTimes.start : ''
return res
}, },
reactEndTime() { timepickerEndTime() {
const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate const activeDate = this.range ? this.tempRange.after : this.calendar.fullDate
const res = activeDate === this.endDate ? this.selectableTimes.end : '' return activeDate === this.endDate ? this.selectableTimes.end : ''
return res
}, },
/** /**
* for i18n * for i18n
...@@ -366,17 +402,13 @@ ...@@ -366,17 +402,13 @@
created() { created() {
// 获取日历方法实例 // 获取日历方法实例
this.cale = new Calendar({ this.cale = new Calendar({
// date: new Date(),
selected: this.selected, selected: this.selected,
startDate: this.startDate, startDate: this.startDate,
endDate: this.endDate, endDate: this.endDate,
range: this.range, range: this.range,
// multipleStatus: this.pleStatus
}) })
// 选中某一天 // 选中某一天
// this.cale.setDate(this.date)
this.init(this.date) this.init(this.date)
// this.setDay
}, },
methods: { methods: {
leaveCale() { leaveCale() {
...@@ -405,10 +437,10 @@ ...@@ -405,10 +437,10 @@
const [yearB, monthB] = B.split('-') const [yearB, monthB] = B.split('-')
return yearA === yearB && monthA === monthB return yearA === yearB && monthA === monthB
}, },
// 蒙版点击事件
// 取消穿透 maskClick() {
clean() {
this.close() this.close()
this.$emit('maskClose')
}, },
clearCalender() { clearCalender() {
...@@ -426,33 +458,51 @@ ...@@ -426,33 +458,51 @@
this.tempSingleDate = '' this.tempSingleDate = ''
} }
this.calendar.fullDate = '' this.calendar.fullDate = ''
this.setDate() this.setDate(new Date())
}, },
bindDateChange(e) { bindDateChange(e) {
const value = e.detail.value + '-1' const value = e.detail.value + '-1'
this.init(value) this.setDate(value)
}, },
/** /**
* 初始化日期显示 * 初始化日期显示
* @param {Object} date * @param {Object} date
*/ */
init(date) { init(date) {
this.cale.setDate(date) // 字节小程序 watch 早于 created
if (!this.cale) {
return
}
this.cale.setDate(date || new Date())
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
this.nowDate = this.calendar = this.cale.getInfo(date) this.nowDate = this.cale.getInfo(date)
}, this.calendar = {
// choiceDate(weeks) { ...this.nowDate
// if (weeks.disable) return }
// this.calendar = weeks if (!date) {
// // 设置多选 // 优化date为空默认不选中今天
// this.cale.setMultiple(this.calendar.fullDate, true) this.calendar.fullDate = ''
// this.weeks = this.cale.weeks if (this.defaultValue && !this.range) {
// this.tempSingleDate = this.calendar.fullDate // 暂时只支持移动端非范围选择
// this.tempRange.before = this.cale.multipleStatus.before const defaultDate = new Date(this.defaultValue)
// this.tempRange.after = this.cale.multipleStatus.after const fullDate = getDate(defaultDate)
// this.change() const year = defaultDate.getFullYear()
// }, const month = defaultDate.getMonth() + 1
const date = defaultDate.getDate()
const day = defaultDate.getDay()
this.calendar = {
fullDate,
year,
month,
date,
day
},
this.tempSingleDate = fullDate
this.time = getTime(defaultDate, this.hideSecond)
}
}
},
/** /**
* 打开日历弹窗 * 打开日历弹窗
*/ */
...@@ -460,7 +510,6 @@ ...@@ -460,7 +510,6 @@
// 弹窗模式并且清理数据 // 弹窗模式并且清理数据
if (this.clearDate && !this.insert) { if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus() this.cale.cleanMultipleStatus()
// this.cale.setDate(this.date)
this.init(this.date) this.init(this.date)
} }
this.show = true this.show = true
...@@ -492,8 +541,8 @@ ...@@ -492,8 +541,8 @@
/** /**
* 变化触发 * 变化触发
*/ */
change() { change(isSingleChange) {
if (!this.insert) return if (!this.insert && !isSingleChange) return
this.setEmit('change') this.setEmit('change')
}, },
/** /**
...@@ -514,12 +563,20 @@ ...@@ -514,12 +563,20 @@
* @param {Object} name * @param {Object} name
*/ */
setEmit(name) { setEmit(name) {
if (!this.range) {
if (!this.calendar.fullDate) {
this.calendar = this.cale.getInfo(new Date())
this.tempSingleDate = this.calendar.fullDate
}
if (this.hasTime && !this.time) {
this.time = getTime(new Date(), this.hideSecond)
}
}
let { let {
year, year,
month, month,
date, date,
fullDate, fullDate,
lunar,
extraInfo extraInfo
} = this.calendar } = this.calendar
this.$emit(name, { this.$emit(name, {
...@@ -530,7 +587,6 @@ ...@@ -530,7 +587,6 @@
time: this.time, time: this.time,
timeRange: this.timeRange, timeRange: this.timeRange,
fulldate: fullDate, fulldate: fullDate,
lunar,
extraInfo: extraInfo || {} extraInfo: extraInfo || {}
}) })
}, },
...@@ -546,48 +602,26 @@ ...@@ -546,48 +602,26 @@
this.cale.setMultiple(this.calendar.fullDate, true) this.cale.setMultiple(this.calendar.fullDate, true)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
this.tempSingleDate = this.calendar.fullDate this.tempSingleDate = this.calendar.fullDate
this.tempRange.before = this.cale.multipleStatus.before const beforeDate = new Date(this.cale.multipleStatus.before).getTime()
this.tempRange.after = this.cale.multipleStatus.after const afterDate = new Date(this.cale.multipleStatus.after).getTime()
this.change() if (beforeDate > afterDate && afterDate) {
}, this.tempRange.before = this.cale.multipleStatus.after
/** this.tempRange.after = this.cale.multipleStatus.before
* 回到今天
*/
backtoday() {
let date = this.cale.getDate(new Date()).fullDate
// this.cale.setDate(date)
this.init(date)
this.change()
},
/**
* 比较时间大小
*/
dateCompare(startDate, endDate) {
// 计算截止时间
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
// 计算详细项的截止时间
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
if (startDate <= endDate) {
return true
} else { } else {
return false this.tempRange.before = this.cale.multipleStatus.before
this.tempRange.after = this.cale.multipleStatus.after
}
this.change(true)
},
changeMonth(type) {
let newDate
if (type === 'pre') {
newDate = this.cale.getPreMonthObj(this.nowDate.fullDate).fullDate
} else if (type === 'next') {
newDate = this.cale.getNextMonthObj(this.nowDate.fullDate).fullDate
} }
},
/**
* 上个月
*/
pre() {
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
this.setDate(preDate)
this.monthSwitch()
}, this.setDate(newDate)
/**
* 下个月
*/
next() {
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
this.setDate(nextDate)
this.monthSwitch() this.monthSwitch()
}, },
/** /**
...@@ -603,7 +637,9 @@ ...@@ -603,7 +637,9 @@
} }
</script> </script>
<style lang="scss" > <style lang="scss">
$uni-primary: #007aff !default;
.uni-calendar { .uni-calendar {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
...@@ -714,7 +750,7 @@ ...@@ -714,7 +750,7 @@
text-align: center; text-align: center;
width: 100px; width: 100px;
font-size: 14px; font-size: 14px;
color: #007aff; color: $uni-primary;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
letter-spacing: 3px; letter-spacing: 3px;
/* #endif */ /* #endif */
...@@ -845,6 +881,9 @@ ...@@ -845,6 +881,9 @@
.uni-date-changed--time-date { .uni-date-changed--time-date {
color: #999; color: #999;
line-height: 50px; line-height: 50px;
/* #ifdef MP-TOUTIAO */
font-size: 16px;
/* #endif */
margin-right: 5px; margin-right: 5px;
// opacity: 0.6; // opacity: 0.6;
} }
...@@ -893,7 +932,7 @@ ...@@ -893,7 +932,7 @@
border-radius: 100px; border-radius: 100px;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
background-color: #007aff; background-color: $uni-primary;
color: #fff; color: #fff;
font-size: 16px; font-size: 16px;
letter-spacing: 2px; letter-spacing: 2px;
...@@ -903,5 +942,6 @@ ...@@ -903,5 +942,6 @@
.uni-datetime-picker--btn:active { .uni-datetime-picker--btn:active {
opacity: 0.7; opacity: 0.7;
} }
/* #endif */ /* #endif */
</style> </style>
{ {
"uni-datetime-picker.selectDate": "select date", "uni-datetime-picker.selectDate": "select date",
"uni-datetime-picker.selectTime": "select time", "uni-datetime-picker.selectTime": "select time",
"uni-datetime-picker.selectDateTime": "select datetime", "uni-datetime-picker.selectDateTime": "select date and time",
"uni-datetime-picker.startDate": "start date", "uni-datetime-picker.startDate": "start date",
"uni-datetime-picker.endDate": "end date", "uni-datetime-picker.endDate": "end date",
"uni-datetime-picker.startTime": "start time", "uni-datetime-picker.startTime": "start time",
......
...@@ -77,21 +77,20 @@ ...@@ -77,21 +77,20 @@
</view> </view>
</view> </view>
</view> </view>
<!-- #ifdef H5 -->
<!-- <keypress v-if="visible" @esc="tiggerTimePicker" @enter="setTime" /> -->
<!-- #endif -->
</view> </view>
</template> </template>
<script> <script>
// #ifdef H5
import keypress from './keypress'
// #endif
import { import {
initVueI18n initVueI18n
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import messages from './i18n/index.js' import i18nMessages from './i18n/index.js'
const { t } = initVueI18n(messages) const {
t
} = initVueI18n(i18nMessages)
import {
fixIosDateFormat
} from './util'
/** /**
* DatetimePicker 时间选择器 * DatetimePicker 时间选择器
...@@ -108,11 +107,6 @@ ...@@ -108,11 +107,6 @@
export default { export default {
name: 'UniDatetimePicker', name: 'UniDatetimePicker',
components: {
// #ifdef H5
keypress
// #endif
},
data() { data() {
return { return {
indicatorStyle: `height: 50px;`, indicatorStyle: `height: 50px;`,
...@@ -146,6 +140,14 @@ ...@@ -146,6 +140,14 @@
endSecond: 59, endSecond: 59,
} }
}, },
options: {
// #ifdef MP-TOUTIAO
virtualHost: false,
// #endif
// #ifndef MP-TOUTIAO
virtualHost: true
// #endif
},
props: { props: {
type: { type: {
type: String, type: String,
...@@ -185,10 +187,25 @@ ...@@ -185,10 +187,25 @@
} }
}, },
watch: { watch: {
// #ifndef VUE3
value: { value: {
handler(newVal, oldVal) { handler(newVal) {
if (newVal) {
this.parseValue(fixIosDateFormat(newVal))
this.initTime(false)
} else {
this.time = ''
this.parseValue(Date.now())
}
},
immediate: true
},
// #endif
// #ifdef VUE3
modelValue: {
handler(newVal) {
if (newVal) { if (newVal) {
this.parseValue(this.fixIosDateFormat(newVal)) //兼容 iOS、safari 日期格式 this.parseValue(fixIosDateFormat(newVal))
this.initTime(false) this.initTime(false)
} else { } else {
this.time = '' this.time = ''
...@@ -197,6 +214,7 @@ ...@@ -197,6 +214,7 @@
}, },
immediate: true immediate: true
}, },
// #endif
type: { type: {
handler(newValue) { handler(newValue) {
if (newValue === 'date') { if (newValue === 'date') {
...@@ -217,13 +235,13 @@ ...@@ -217,13 +235,13 @@
}, },
start: { start: {
handler(newVal) { handler(newVal) {
this.parseDatetimeRange(this.fixIosDateFormat(newVal), 'start') //兼容 iOS、safari 日期格式 this.parseDatetimeRange(fixIosDateFormat(newVal), 'start')
}, },
immediate: true immediate: true
}, },
end: { end: {
handler(newVal) { handler(newVal) {
this.parseDatetimeRange(this.fixIosDateFormat(newVal), 'end') //兼容 iOS、safari 日期格式 this.parseDatetimeRange(fixIosDateFormat(newVal), 'end')
}, },
immediate: true immediate: true
}, },
...@@ -527,7 +545,7 @@ ...@@ -527,7 +545,7 @@
const day = now.getDate() const day = now.getDate()
dateBase = year + '/' + month + '/' + day + ' ' dateBase = year + '/' + month + '/' + day + ' '
} }
if (Number(value) && typeof value !== NaN) { if (Number(value)) {
value = parseInt(value) value = parseInt(value)
dateBase = 0 dateBase = 0
} }
...@@ -598,7 +616,7 @@ ...@@ -598,7 +616,7 @@
pointType === 'start' ? this.startYear = this.year - 60 : this.endYear = this.year + 60 pointType === 'start' ? this.startYear = this.year - 60 : this.endYear = this.year + 60
return return
} }
if (Number(point) && Number(point) !== NaN) { if (Number(point)) {
point = parseInt(point) point = parseInt(point)
} }
// datetime 的 end 没有时分秒, 则不限制 // datetime 的 end 没有时分秒, 则不限制
...@@ -645,14 +663,6 @@ ...@@ -645,14 +663,6 @@
return new Date(year, month, 0).getDate(); return new Date(year, month, 0).getDate();
}, },
//兼容 iOS、safari 日期格式
fixIosDateFormat(value) {
if (typeof value === 'string') {
value = value.replace(/-/g, '/')
}
return value
},
/** /**
* 生成时间戳 * 生成时间戳
* @param {Object} time * @param {Object} time
...@@ -736,7 +746,7 @@ ...@@ -736,7 +746,7 @@
*/ */
initTimePicker() { initTimePicker() {
if (this.disabled) return if (this.disabled) return
const value = this.fixIosDateFormat(this.value) const value = fixIosDateFormat(this.time)
this.initPickerValue(value) this.initPickerValue(value)
this.visible = !this.visible this.visible = !this.visible
}, },
...@@ -770,7 +780,9 @@ ...@@ -770,7 +780,9 @@
} }
</script> </script>
<style> <style lang="scss">
$uni-primary: #007aff !default;
.uni-datetime-picker { .uni-datetime-picker {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
/* width: 100%; */ /* width: 100%; */
...@@ -804,7 +816,7 @@ ...@@ -804,7 +816,7 @@
.uni-datetime-picker-btn-text { .uni-datetime-picker-btn-text {
font-size: 14px; font-size: 14px;
color: #007AFF; color: $uni-primary;
} }
.uni-datetime-picker-btn-group { .uni-datetime-picker-btn-group {
...@@ -889,6 +901,7 @@ ...@@ -889,6 +901,7 @@
.uni-datetime-picker-text { .uni-datetime-picker-text {
font-size: 14px; font-size: 14px;
line-height: 50px
} }
.uni-datetime-picker-sign { .uni-datetime-picker-sign {
......
...@@ -2,96 +2,103 @@ ...@@ -2,96 +2,103 @@
<view class="uni-date"> <view class="uni-date">
<view class="uni-date-editor" @click="show"> <view class="uni-date-editor" @click="show">
<slot> <slot>
<view class="uni-date-editor--x" :class="{'uni-date-editor--x__disabled': disabled, <view class="uni-date-editor--x"
'uni-date-x--border': border}"> :class="{'uni-date-editor--x__disabled': disabled,'uni-date-x--border': border}">
<view v-if="!isRange" class="uni-date-x uni-date-single"> <view v-if="!isRange" class="uni-date-x uni-date-single">
<uni-icons type="calendar" color="#c0c4cc" size="22"></uni-icons> <uni-icons class="icon-calendar" type="calendar" color="#c0c4cc" size="22"></uni-icons>
<input class="uni-date__x-input" type="text" v-model="singleVal" <view class="uni-date__x-input">{{ displayValue || singlePlaceholderText }}</view>
:placeholder="singlePlaceholderText" :disabled="true" />
</view> </view>
<view v-else class="uni-date-x uni-date-range"> <view v-else class="uni-date-x uni-date-range">
<uni-icons type="calendar" color="#c0c4cc" size="22"></uni-icons> <uni-icons class="icon-calendar" type="calendar" color="#c0c4cc" size="22"></uni-icons>
<input class="uni-date__x-input t-c" type="text" v-model="range.startDate" <view class="uni-date__x-input text-center">{{ displayRangeValue.startDate || startPlaceholderText }}</view>
:placeholder="startPlaceholderText" :disabled="true" />
<slot> <view class="range-separator">{{rangeSeparator}}</view>
<view class="">{{rangeSeparator}}</view>
</slot> <view class="uni-date__x-input text-center">{{ displayRangeValue.endDate || endPlaceholderText }}</view>
<input class="uni-date__x-input t-c" type="text" v-model="range.endDate"
:placeholder="endPlaceholderText" :disabled="true" />
</view> </view>
<view v-if="showClearIcon" class="uni-date__icon-clear" @click.stop="clear"> <view v-if="showClearIcon" class="uni-date__icon-clear" @click.stop="clear">
<uni-icons type="clear" color="#c0c4cc" size="24"></uni-icons> <uni-icons type="clear" color="#c0c4cc" size="22"></uni-icons>
</view> </view>
</view> </view>
</slot> </slot>
</view> </view>
<view v-show="popup" class="uni-date-mask" @click="close"></view> <view v-show="pickerVisible" class="uni-date-mask--pc" @click="close"></view>
<view v-if="!isPhone" ref="datePicker" v-show="popup" class="uni-date-picker__container">
<view v-if="!isRange" class="uni-date-single--x" :style="popover"> <view v-if="!isPhone" v-show="pickerVisible" ref="datePicker" class="uni-date-picker__container">
<view v-if="!isRange" class="uni-date-single--x" :style="pickerPositionStyle">
<view class="uni-popper__arrow"></view> <view class="uni-popper__arrow"></view>
<view v-if="hasTime" class="uni-date-changed popup-x-header"> <view v-if="hasTime" class="uni-date-changed popup-x-header">
<input class="uni-date__input t-c" type="text" v-model="tempSingleDate" <input class="uni-date__input text-center" type="text" v-model="inputDate" :placeholder="selectDateText" />
:placeholder="selectDateText" />
<time-picker type="time" v-model="time" :border="false" :disabled="!tempSingleDate" <time-picker type="time" v-model="pickerTime" :border="false" :disabled="!inputDate"
:start="reactStartTime" :end="reactEndTime" :hideSecond="hideSecond" style="width: 100%;"> :start="timepickerStartTime" :end="timepickerEndTime" :hideSecond="hideSecond" style="width: 100%;">
<input class="uni-date__input t-c" type="text" v-model="time" :placeholder="selectTimeText" <input class="uni-date__input text-center" type="text" v-model="pickerTime" :placeholder="selectTimeText"
:disabled="!tempSingleDate" /> :disabled="!inputDate" />
</time-picker> </time-picker>
</view> </view>
<calendar ref="pcSingle" :showMonth="false" :start-date="caleRange.startDate"
:end-date="caleRange.endDate" :date="defSingleDate" @change="singleChange" <Calendar ref="pcSingle" :showMonth="false" :start-date="calendarRange.startDate"
:end-date="calendarRange.endDate" :date="calendarDate" @change="singleChange" :default-value="defaultValue"
style="padding: 0 8px;" /> style="padding: 0 8px;" />
<view v-if="hasTime" class="popup-x-footer"> <view v-if="hasTime" class="popup-x-footer">
<!-- <text class="">此刻</text> --> <text class="confirm-text" @click="confirmSingleChange">{{okText}}</text>
<text class="confirm" @click="confirmSingleChange">{{okText}}</text>
</view> </view>
<view class="uni-date-popper__arrow"></view>
</view> </view>
<view v-else class="uni-date-range--x" :style="popover"> <view v-else class="uni-date-range--x" :style="pickerPositionStyle">
<view class="uni-popper__arrow"></view> <view class="uni-popper__arrow"></view>
<view v-if="hasTime" class="popup-x-header uni-date-changed"> <view v-if="hasTime" class="popup-x-header uni-date-changed">
<view class="popup-x-header--datetime"> <view class="popup-x-header--datetime">
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.startDate" <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.startDate"
:placeholder="startDateText" /> :placeholder="startDateText" />
<time-picker type="time" v-model="tempRange.startTime" :start="reactStartTime" :border="false"
<time-picker type="time" v-model="tempRange.startTime" :start="timepickerStartTime" :border="false"
:disabled="!tempRange.startDate" :hideSecond="hideSecond"> :disabled="!tempRange.startDate" :hideSecond="hideSecond">
<input class="uni-date__input uni-date-range__input" type="text" <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.startTime"
v-model="tempRange.startTime" :placeholder="startTimeText" :placeholder="startTimeText" :disabled="!tempRange.startDate" />
:disabled="!tempRange.startDate" />
</time-picker> </time-picker>
</view> </view>
<uni-icons type="arrowthinright" color="#999" style="line-height: 40px;"></uni-icons> <uni-icons type="arrowthinright" color="#999" style="line-height: 40px;"></uni-icons>
<view class="popup-x-header--datetime"> <view class="popup-x-header--datetime">
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endDate" <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endDate"
:placeholder="endDateText" /> :placeholder="endDateText" />
<time-picker type="time" v-model="tempRange.endTime" :end="reactEndTime" :border="false"
<time-picker type="time" v-model="tempRange.endTime" :end="timepickerEndTime" :border="false"
:disabled="!tempRange.endDate" :hideSecond="hideSecond"> :disabled="!tempRange.endDate" :hideSecond="hideSecond">
<input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endTime" <input class="uni-date__input uni-date-range__input" type="text" v-model="tempRange.endTime"
:placeholder="endTimeText" :disabled="!tempRange.endDate" /> :placeholder="endTimeText" :disabled="!tempRange.endDate" />
</time-picker> </time-picker>
</view> </view>
</view> </view>
<view class="popup-x-body"> <view class="popup-x-body">
<calendar ref="left" :showMonth="false" :start-date="caleRange.startDate" <Calendar ref="left" :showMonth="false" :start-date="calendarRange.startDate"
:end-date="caleRange.endDate" :range="true" @change="leftChange" :pleStatus="endMultipleStatus" :end-date="calendarRange.endDate" :range="true" :pleStatus="endMultipleStatus" @change="leftChange"
@firstEnterCale="updateRightCale" @monthSwitch="leftMonthSwitch" style="padding: 0 8px;" /> @firstEnterCale="updateRightCale" style="padding: 0 8px;"/>
<calendar ref="right" :showMonth="false" :start-date="caleRange.startDate" <Calendar ref="right" :showMonth="false" :start-date="calendarRange.startDate"
:end-date="caleRange.endDate" :range="true" @change="rightChange" :end-date="calendarRange.endDate" :range="true" @change="rightChange" :pleStatus="startMultipleStatus"
:pleStatus="startMultipleStatus" @firstEnterCale="updateLeftCale" @firstEnterCale="updateLeftCale" style="padding: 0 8px;border-left: 1px solid #F1F1F1;" />
@monthSwitch="rightMonthSwitch" style="padding: 0 8px;border-left: 1px solid #F1F1F1;" />
</view> </view>
<view v-if="hasTime" class="popup-x-footer"> <view v-if="hasTime" class="popup-x-footer">
<text class="" @click="clear">{{clearText}}</text> <text @click="clear">{{clearText}}</text>
<text class="confirm" @click="confirmRangeChange">{{okText}}</text> <text class="confirm-text" @click="confirmRangeChange">{{okText}}</text>
</view> </view>
</view> </view>
</view> </view>
<calendar v-show="isPhone" ref="mobile" :clearDate="false" :date="defSingleDate" :defTime="reactMobDefTime"
:start-date="caleRange.startDate" :end-date="caleRange.endDate" :selectableTimes="mobSelectableTime" <Calendar v-if="isPhone" ref="mobile" :clearDate="false" :date="calendarDate" :defTime="mobileCalendarTime"
:pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :typeHasTime="hasTime" :insert="false" :start-date="calendarRange.startDate" :end-date="calendarRange.endDate" :selectableTimes="mobSelectableTime"
:hideSecond="hideSecond" @confirm="mobileChange" /> :startPlaceholder="startPlaceholder" :endPlaceholder="endPlaceholder" :default-value="defaultValue"
:pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :hasTime="hasTime" :insert="false"
:hideSecond="hideSecond" @confirm="mobileChange" @maskClose="close" @change="calendarClick"/>
</view> </view>
</template> </template>
<script> <script>
...@@ -110,62 +117,61 @@ ...@@ -110,62 +117,61 @@
* @property {Boolean} border = [true|false] 是否有边框 * @property {Boolean} border = [true|false] 是否有边框
* @property {Boolean} disabled = [true|false] 是否禁用 * @property {Boolean} disabled = [true|false] 是否禁用
* @property {Boolean} clearIcon = [true|false] 是否显示清除按钮(仅PC端适用) * @property {Boolean} clearIcon = [true|false] 是否显示清除按钮(仅PC端适用)
* @property {[String} defaultValue 选择器打开时默认显示的时间
* @event {Function} change 确定日期时触发的事件 * @event {Function} change 确定日期时触发的事件
* @event {Function} maskClick 点击遮罩层触发的事件
* @event {Function} show 打开弹出层 * @event {Function} show 打开弹出层
* @event {Function} close 关闭弹出层 * @event {Function} close 关闭弹出层
* @event {Function} clear 清除上次选中的状态和值 * @event {Function} clear 清除上次选中的状态和值
**/ **/
import calendar from './calendar.vue' import Calendar from './calendar.vue'
import timePicker from './time-picker.vue' import TimePicker from './time-picker.vue'
import { import {
initVueI18n initVueI18n
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import messages from './i18n/index.js' import i18nMessages from './i18n/index.js'
const { import {
t getDateTime,
} = initVueI18n(messages) getDate,
getTime,
getDefaultSecond,
dateCompare,
checkDate,
fixIosDateFormat
} from './util'
export default { export default {
name: 'UniDatetimePicker', name: 'UniDatetimePicker',
options: { options: {
// #ifdef MP-TOUTIAO
virtualHost: false,
// #endif
// #ifndef MP-TOUTIAO
virtualHost: true virtualHost: true
// #endif
}, },
components: { components: {
calendar, Calendar,
timePicker TimePicker
},
inject: {
form: {
from: 'uniForm',
default: null
},
formItem: {
from: 'uniFormItem',
default: null
},
}, },
data() { data() {
return { return {
isRange: false, isRange: false,
hasTime: false, hasTime: false,
mobileRange: false, displayValue: '',
// 单选 inputDate: '',
singleVal: '', calendarDate: '',
tempSingleDate: '', pickerTime: '',
defSingleDate: '', calendarRange: {
time: '',
// 范围选
caleRange: {
startDate: '', startDate: '',
startTime: '', startTime: '',
endDate: '', endDate: '',
endTime: '' endTime: ''
}, },
range: { displayRangeValue: {
startDate: '', startDate: '',
// startTime: '',
endDate: '', endDate: '',
// endTime: ''
}, },
tempRange: { tempRange: {
startDate: '', startDate: '',
...@@ -186,12 +192,12 @@ ...@@ -186,12 +192,12 @@
data: [], data: [],
fulldate: '' fulldate: ''
}, },
visible: false, pickerVisible: false,
popup: false, pickerPositionStyle: null,
popover: null,
isEmitValue: false, isEmitValue: false,
isPhone: false, isPhone: false,
isFirstShow: true, isFirstShow: true,
i18nT: () => {}
} }
}, },
props: { props: {
...@@ -250,28 +256,24 @@ ...@@ -250,28 +256,24 @@
hideSecond: { hideSecond: {
type: [Boolean], type: [Boolean],
default: false default: false
},
defaultValue: {
type: [String, Object, Array],
default: ''
} }
}, },
watch: { watch: {
type: { type: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
if (newVal.indexOf('time') !== -1) { this.hasTime = newVal.indexOf('time') !== -1
this.hasTime = true this.isRange = newVal.indexOf('range') !== -1
} else {
this.hasTime = false
}
if (newVal.indexOf('range') !== -1) {
this.isRange = true
} else {
this.isRange = false
}
} }
}, },
// #ifndef VUE3 // #ifndef VUE3
value: { value: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
if (this.isEmitValue) { if (this.isEmitValue) {
this.isEmitValue = false this.isEmitValue = false
return return
...@@ -283,7 +285,7 @@ ...@@ -283,7 +285,7 @@
// #ifdef VUE3 // #ifdef VUE3
modelValue: { modelValue: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
if (this.isEmitValue) { if (this.isEmitValue) {
this.isEmitValue = false this.isEmitValue = false
return return
...@@ -294,55 +296,45 @@ ...@@ -294,55 +296,45 @@
// #endif // #endif
start: { start: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
if (!newVal) return if (!newVal) return
const { this.calendarRange.startDate = getDate(newVal)
defDate,
defTime
} = this.parseDate(newVal)
this.caleRange.startDate = defDate
if (this.hasTime) { if (this.hasTime) {
this.caleRange.startTime = defTime this.calendarRange.startTime = getTime(newVal)
} }
} }
}, },
end: { end: {
immediate: true, immediate: true,
handler(newVal, oldVal) { handler(newVal) {
if (!newVal) return if (!newVal) return
const { this.calendarRange.endDate = getDate(newVal)
defDate,
defTime
} = this.parseDate(newVal)
this.caleRange.endDate = defDate
if (this.hasTime) { if (this.hasTime) {
this.caleRange.endTime = defTime this.calendarRange.endTime = getTime(newVal, this.hideSecond)
} }
} }
}, },
}, },
computed: { computed: {
reactStartTime() { timepickerStartTime() {
const activeDate = this.isRange ? this.tempRange.startDate : this.tempSingleDate const activeDate = this.isRange ? this.tempRange.startDate : this.inputDate
const res = activeDate === this.caleRange.startDate ? this.caleRange.startTime : '' return activeDate === this.calendarRange.startDate ? this.calendarRange.startTime : ''
return res },
}, timepickerEndTime() {
reactEndTime() { const activeDate = this.isRange ? this.tempRange.endDate : this.inputDate
const activeDate = this.isRange ? this.tempRange.endDate : this.tempSingleDate return activeDate === this.calendarRange.endDate ? this.calendarRange.endTime : ''
const res = activeDate === this.caleRange.endDate ? this.caleRange.endTime : '' },
return res mobileCalendarTime() {
}, const timeRange = {
reactMobDefTime() {
const times = {
start: this.tempRange.startTime, start: this.tempRange.startTime,
end: this.tempRange.endTime end: this.tempRange.endTime
} }
return this.isRange ? times : this.time return this.isRange ? timeRange : this.pickerTime
}, },
mobSelectableTime() { mobSelectableTime() {
return { return {
start: this.caleRange.startTime, start: this.calendarRange.startTime,
end: this.caleRange.endTime end: this.calendarRange.endTime
} }
}, },
datePopupWidth() { datePopupWidth() {
...@@ -354,8 +346,7 @@ ...@@ -354,8 +346,7 @@
* for i18n * for i18n
*/ */
singlePlaceholderText() { singlePlaceholderText() {
return this.placeholder || (this.type === 'date' ? this.selectDateText : t( return this.placeholder || (this.type === 'date' ? this.selectDateText : this.selectDateTimeText)
"uni-datetime-picker.selectDateTime"))
}, },
startPlaceholderText() { startPlaceholderText() {
return this.startPlaceholder || this.startDateText return this.startPlaceholder || this.startDateText
...@@ -364,89 +355,89 @@ ...@@ -364,89 +355,89 @@
return this.endPlaceholder || this.endDateText return this.endPlaceholder || this.endDateText
}, },
selectDateText() { selectDateText() {
return t("uni-datetime-picker.selectDate") return this.i18nT("uni-datetime-picker.selectDate")
},
selectDateTimeText() {
return this.i18nT("uni-datetime-picker.selectDateTime")
}, },
selectTimeText() { selectTimeText() {
return t("uni-datetime-picker.selectTime") return this.i18nT("uni-datetime-picker.selectTime")
}, },
startDateText() { startDateText() {
return this.startPlaceholder || t("uni-datetime-picker.startDate") return this.startPlaceholder || this.i18nT("uni-datetime-picker.startDate")
}, },
startTimeText() { startTimeText() {
return t("uni-datetime-picker.startTime") return this.i18nT("uni-datetime-picker.startTime")
}, },
endDateText() { endDateText() {
return this.endPlaceholder || t("uni-datetime-picker.endDate") return this.endPlaceholder || this.i18nT("uni-datetime-picker.endDate")
}, },
endTimeText() { endTimeText() {
return t("uni-datetime-picker.endTime") return this.i18nT("uni-datetime-picker.endTime")
}, },
okText() { okText() {
return t("uni-datetime-picker.ok") return this.i18nT("uni-datetime-picker.ok")
}, },
clearText() { clearText() {
return t("uni-datetime-picker.clear") return this.i18nT("uni-datetime-picker.clear")
}, },
showClearIcon() { showClearIcon() {
const { return this.clearIcon && !this.disabled && (this.displayValue || (this.displayRangeValue.startDate && this
clearIcon, .displayRangeValue.endDate))
disabled,
singleVal,
range
} = this
const bool = clearIcon && !disabled && (singleVal || (range.startDate && range.endDate))
return bool
} }
}, },
created() { created() {
// if (this.form && this.formItem) { this.initI18nT()
// this.$watch('formItem.errMsg', (newVal) => {
// this.localMsg = newVal
// })
// }
},
mounted() {
this.platform() this.platform()
}, },
methods: { methods: {
initI18nT() {
const vueI18n = initVueI18n(i18nMessages)
this.i18nT = vueI18n.t
},
initPicker(newVal) { initPicker(newVal) {
if (!newVal || Array.isArray(newVal) && !newVal.length) { if ((!newVal && !this.defaultValue) || Array.isArray(newVal) && !newVal.length) {
this.$nextTick(() => { this.$nextTick(() => {
this.clear(false) this.clear(false)
}) })
return return
} }
if (!Array.isArray(newVal) && !this.isRange) { if (!Array.isArray(newVal) && !this.isRange) {
const { if (newVal) {
defDate, this.displayValue = this.inputDate = this.calendarDate = getDate(newVal)
defTime if (this.hasTime) {
} = this.parseDate(newVal) this.pickerTime = getTime(newVal, this.hideSecond)
this.singleVal = defDate this.displayValue = `${this.displayValue} ${this.pickerTime}`
this.tempSingleDate = defDate }
this.defSingleDate = defDate } else if (this.defaultValue) {
if (this.hasTime) { this.inputDate = this.calendarDate = getDate(this.defaultValue)
this.singleVal = defDate + ' ' + defTime if (this.hasTime) {
this.time = defTime this.pickerTime = getTime(this.defaultValue, this.hideSecond)
}
} }
} else { } else {
const [before, after] = newVal const [before, after] = newVal
if (!before && !after) return if (!before && !after) return
const defBefore = this.parseDate(before) const beforeDate = getDate(before)
const defAfter = this.parseDate(after) const beforeTime = getTime(before, this.hideSecond)
const startDate = defBefore.defDate
const endDate = defAfter.defDate const afterDate = getDate(after)
this.range.startDate = this.tempRange.startDate = startDate const afterTime = getTime(after, this.hideSecond)
this.range.endDate = this.tempRange.endDate = endDate const startDate = beforeDate
const endDate = afterDate
this.displayRangeValue.startDate = this.tempRange.startDate = startDate
this.displayRangeValue.endDate = this.tempRange.endDate = endDate
if (this.hasTime) { if (this.hasTime) {
this.range.startDate = defBefore.defDate + ' ' + defBefore.defTime this.displayRangeValue.startDate = `${beforeDate} ${beforeTime}`
this.range.endDate = defAfter.defDate + ' ' + defAfter.defTime this.displayRangeValue.endDate = `${afterDate} ${afterTime}`
this.tempRange.startTime = defBefore.defTime this.tempRange.startTime = beforeTime
this.tempRange.endTime = defAfter.defTime this.tempRange.endTime = afterTime
} }
const defaultRange = { const defaultRange = {
before: defBefore.defDate, before: beforeDate,
after: defAfter.defDate after: afterDate
} }
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, { this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, defaultRange, {
which: 'right' which: 'right'
...@@ -469,53 +460,64 @@ ...@@ -469,53 +460,64 @@
right.setDate(this.$refs.right.nowDate.fullDate) right.setDate(this.$refs.right.nowDate.fullDate)
}, },
platform() { platform() {
const systemInfo = uni.getSystemInfoSync() if (typeof navigator !== "undefined") {
this.isPhone = systemInfo.windowWidth <= 500 this.isPhone = navigator.userAgent.toLowerCase().indexOf('mobile') !== -1
this.windowWidth = systemInfo.windowWidth return
}
const {
windowWidth
} = uni.getSystemInfoSync()
this.isPhone = windowWidth <= 500
this.windowWidth = windowWidth
}, },
show(event) { show() {
this.$emit("show")
if (this.disabled) { if (this.disabled) {
return return
} }
this.platform() this.platform()
if (this.isPhone) { if (this.isPhone) {
this.$refs.mobile.open() setTimeout(() => {
this.$refs.mobile.open()
}, 0);
return return
} }
this.popover = { this.pickerPositionStyle = {
top: '10px' top: '10px'
} }
const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor") const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor")
dateEditor.boundingClientRect(rect => { dateEditor.boundingClientRect(rect => {
if (this.windowWidth - rect.left < this.datePopupWidth) { if (this.windowWidth - rect.left < this.datePopupWidth) {
this.popover.right = 0 this.pickerPositionStyle.right = 0
} }
}).exec() }).exec()
setTimeout(() => { setTimeout(() => {
this.popup = !this.popup this.pickerVisible = !this.pickerVisible
if (!this.isPhone && this.isRange && this.isFirstShow) { if (!this.isPhone && this.isRange && this.isFirstShow) {
this.isFirstShow = false this.isFirstShow = false
const { const {
startDate, startDate,
endDate endDate
} = this.range } = this.calendarRange
if (startDate && endDate) { if (startDate && endDate) {
if (this.diffDate(startDate, endDate) < 30) { if (this.diffDate(startDate, endDate) < 30) {
this.$refs.right.next() this.$refs.right.changeMonth('pre')
} }
} else { } else {
this.$refs.right.next() // this.$refs.right.changeMonth('next')
this.$refs.right.cale.lastHover = false if (this.isPhone) {
this.$refs.right.cale.lastHover = false;
}
} }
} }
}, 50) }, 50)
}, },
close() { close() {
setTimeout(() => { setTimeout(() => {
this.popup = false this.pickerVisible = false
this.$emit('maskClick', this.value) this.$emit('maskClick', this.value)
this.$refs.mobile && this.$refs.mobile.close()
}, 20) }, 20)
}, },
setEmit(value) { setEmit(value) {
...@@ -541,37 +543,72 @@ ...@@ -541,37 +543,72 @@
} }
} }
} }
this.$emit('change', value)
this.$emit('input', value)
this.$emit('update:modelValue', value) this.$emit('update:modelValue', value)
this.$emit('input', value)
this.$emit('change', value)
this.isEmitValue = true this.isEmitValue = true
}, },
createTimestamp(date) { createTimestamp(date) {
date = this.fixIosDateFormat(date) date = fixIosDateFormat(date)
return Date.parse(new Date(date)) return Date.parse(new Date(date))
}, },
singleChange(e) { singleChange(e) {
this.tempSingleDate = e.fulldate this.calendarDate = this.inputDate = e.fulldate
if (this.hasTime) return if (this.hasTime) return
this.confirmSingleChange() this.confirmSingleChange()
}, },
confirmSingleChange() { confirmSingleChange() {
if (!this.tempSingleDate) { if (!checkDate(this.inputDate)) {
this.popup = false const now = new Date()
return this.calendarDate = this.inputDate = getDate(now)
this.pickerTime = getTime(now, this.hideSecond)
}
let startLaterInputDate = false
let startDate, startTime
if (this.start) {
let startString = this.start
if (typeof this.start === 'number') {
startString = getDateTime(this.start, this.hideSecond)
}
[startDate, startTime] = startString.split(' ')
if (this.start && !dateCompare(startDate, this.inputDate)) {
startLaterInputDate = true
this.inputDate = startDate
}
}
let endEarlierInputDate = false
let endDate, endTime
if (this.end) {
let endString = this.end
if (typeof this.end === 'number') {
endString = getDateTime(this.end, this.hideSecond)
}
[endDate, endTime] = endString.split(' ')
if (this.end && !dateCompare(this.inputDate, endDate)) {
endEarlierInputDate = true
this.inputDate = endDate
}
} }
if (this.hasTime) { if (this.hasTime) {
this.singleVal = this.tempSingleDate + ' ' + (this.time ? this.time : '00:00:00') if (startLaterInputDate) {
this.pickerTime = startTime || getDefaultSecond(this.hideSecond)
}
if (endEarlierInputDate) {
this.pickerTime = endTime || getDefaultSecond(this.hideSecond)
}
if (!this.pickerTime) {
this.pickerTime = getTime(Date.now(), this.hideSecond)
}
this.displayValue = `${this.inputDate} ${this.pickerTime}`
} else { } else {
this.singleVal = this.tempSingleDate this.displayValue = this.inputDate
} }
this.setEmit(this.singleVal) this.setEmit(this.displayValue)
this.popup = false this.pickerVisible = false
}, },
leftChange(e) { leftChange(e) {
const { const {
before, before,
...@@ -585,8 +622,8 @@ ...@@ -585,8 +622,8 @@
fulldate: e.fulldate fulldate: e.fulldate
} }
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj) this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj)
this.$emit('calendarClick', e)
}, },
rightChange(e) { rightChange(e) {
const { const {
before, before,
...@@ -600,14 +637,18 @@ ...@@ -600,14 +637,18 @@
fulldate: e.fulldate fulldate: e.fulldate
} }
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj) this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj)
this.$emit('calendarClick', e)
}, },
mobileChange(e) { mobileChange(e) {
if (this.isRange) { if (this.isRange) {
const { const {
before, before,
after after
} = e.range } = e.range
if (!before) {
return;
}
this.handleStartAndEnd(before, after, true) this.handleStartAndEnd(before, after, true)
if (this.hasTime) { if (this.hasTime) {
const { const {
...@@ -618,57 +659,114 @@ ...@@ -618,57 +659,114 @@
this.tempRange.endTime = endTime this.tempRange.endTime = endTime
} }
this.confirmRangeChange() this.confirmRangeChange()
} else { } else {
if (this.hasTime) { if (this.hasTime) {
this.singleVal = e.fulldate + ' ' + e.time this.displayValue = e.fulldate + ' ' + e.time
} else { } else {
this.singleVal = e.fulldate this.displayValue = e.fulldate
} }
this.setEmit(this.singleVal) this.setEmit(this.displayValue)
} }
this.$refs.mobile.close() this.$refs.mobile.close()
}, },
rangeChange(before, after) { rangeChange(before, after) {
if (!(before && after)) return if (!(before && after)) return
this.handleStartAndEnd(before, after, true) this.handleStartAndEnd(before, after, true)
if (this.hasTime) return if (this.hasTime) return
this.confirmRangeChange() this.confirmRangeChange()
}, },
confirmRangeChange() { confirmRangeChange() {
if (!this.tempRange.startDate && !this.tempRange.endDate) { if (!this.tempRange.startDate || !this.tempRange.endDate) {
this.popup = false this.pickerVisible = false
return return
} }
if (!checkDate(this.tempRange.startDate)) {
this.tempRange.startDate = getDate(Date.now())
}
if (!checkDate(this.tempRange.endDate)) {
this.tempRange.endDate = getDate(Date.now())
}
let start, end let start, end
let startDateLaterRangeStartDate = false
let startDateLaterRangeEndDate = false
let startDate, startTime
if (this.start) {
let startString = this.start
if (typeof this.start === 'number') {
startString = getDateTime(this.start, this.hideSecond)
}
[startDate, startTime] = startString.split(' ')
if (this.start && !dateCompare(this.start, this.tempRange.startDate)) {
startDateLaterRangeStartDate = true
this.tempRange.startDate = startDate
}
if (this.start && !dateCompare(this.start, this.tempRange.endDate)) {
startDateLaterRangeEndDate = true
this.tempRange.endDate = startDate
}
}
let endDateEarlierRangeStartDate = false
let endDateEarlierRangeEndDate = false
let endDate, endTime
if (this.end) {
let endString = this.end
if (typeof this.end === 'number') {
endString = getDateTime(this.end, this.hideSecond)
}
[endDate, endTime] = endString.split(' ')
if (this.end && !dateCompare(this.tempRange.startDate, this.end)) {
endDateEarlierRangeStartDate = true
this.tempRange.startDate = endDate
}
if (this.end && !dateCompare(this.tempRange.endDate, this.end)) {
endDateEarlierRangeEndDate = true
this.tempRange.endDate = endDate
}
}
if (!this.hasTime) { if (!this.hasTime) {
start = this.range.startDate = this.tempRange.startDate start = this.displayRangeValue.startDate = this.tempRange.startDate
end = this.range.endDate = this.tempRange.endDate end = this.displayRangeValue.endDate = this.tempRange.endDate
} else { } else {
start = this.range.startDate = this.tempRange.startDate + ' ' + if (startDateLaterRangeStartDate) {
(this.tempRange.startTime ? this.tempRange.startTime : '00:00:00') this.tempRange.startTime = startTime || getDefaultSecond(this.hideSecond)
end = this.range.endDate = this.tempRange.endDate + ' ' + } else if (endDateEarlierRangeStartDate) {
(this.tempRange.endTime ? this.tempRange.endTime : '00:00:00') this.tempRange.startTime = endTime || getDefaultSecond(this.hideSecond)
}
if (!this.tempRange.startTime) {
this.tempRange.startTime = getTime(Date.now(), this.hideSecond)
}
if (startDateLaterRangeEndDate) {
this.tempRange.endTime = startTime || getDefaultSecond(this.hideSecond)
} else if (endDateEarlierRangeEndDate) {
this.tempRange.endTime = endTime || getDefaultSecond(this.hideSecond)
}
if (!this.tempRange.endTime) {
this.tempRange.endTime = getTime(Date.now(), this.hideSecond)
}
start = this.displayRangeValue.startDate = `${this.tempRange.startDate} ${this.tempRange.startTime}`
end = this.displayRangeValue.endDate = `${this.tempRange.endDate} ${this.tempRange.endTime}`
}
if (!dateCompare(start, end)) {
[start, end] = [end, start]
} }
this.displayRangeValue.startDate = start
this.displayRangeValue.endDate = end
const displayRange = [start, end] const displayRange = [start, end]
this.setEmit(displayRange) this.setEmit(displayRange)
this.popup = false this.pickerVisible = false
}, },
handleStartAndEnd(before, after, temp = false) { handleStartAndEnd(before, after, temp = false) {
if (!(before && after)) return if (!before) return
if (!after) after = before;
const type = temp ? 'tempRange' : 'range' const type = temp ? 'tempRange' : 'range'
if (this.dateCompare(before, after)) { const isStartEarlierEnd = dateCompare(before, after)
this[type].startDate = before this[type].startDate = isStartEarlierEnd ? before : after
this[type].endDate = after this[type].endDate = isStartEarlierEnd ? after : before
} else {
this[type].startDate = after
this[type].endDate = before
}
}, },
/** /**
* 比较时间大小 * 比较时间大小
*/ */
...@@ -677,11 +775,7 @@ ...@@ -677,11 +775,7 @@
startDate = new Date(startDate.replace('-', '/').replace('-', '/')) startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
// 计算详细项的截止时间 // 计算详细项的截止时间
endDate = new Date(endDate.replace('-', '/').replace('-', '/')) endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
if (startDate <= endDate) { return startDate <= endDate
return true
} else {
return false
}
}, },
/** /**
...@@ -698,31 +792,22 @@ ...@@ -698,31 +792,22 @@
clear(needEmit = true) { clear(needEmit = true) {
if (!this.isRange) { if (!this.isRange) {
this.singleVal = '' this.displayValue = ''
this.tempSingleDate = '' this.inputDate = ''
this.time = '' this.pickerTime = ''
if (this.isPhone) { if (this.isPhone) {
this.$refs.mobile && this.$refs.mobile.clearCalender() this.$refs.mobile && this.$refs.mobile.clearCalender()
} else { } else {
this.$refs.pcSingle && this.$refs.pcSingle.clearCalender() this.$refs.pcSingle && this.$refs.pcSingle.clearCalender()
} }
if (needEmit) { if (needEmit) {
// 校验规则
// if(this.form && this.formItem){
// const {
// validateTrigger
// } = this.form
// if (validateTrigger === 'blur') {
// this.formItem.onFieldChange()
// }
// }
this.$emit('change', '') this.$emit('change', '')
this.$emit('input', '') this.$emit('input', '')
this.$emit('update:modelValue', '') this.$emit('update:modelValue', '')
} }
} else { } else {
this.range.startDate = '' this.displayRangeValue.startDate = ''
this.range.endDate = '' this.displayRangeValue.endDate = ''
this.tempRange.startDate = '' this.tempRange.startDate = ''
this.tempRange.startTime = '' this.tempRange.startTime = ''
this.tempRange.endDate = '' this.tempRange.endDate = ''
...@@ -732,7 +817,7 @@ ...@@ -732,7 +817,7 @@
} else { } else {
this.$refs.left && this.$refs.left.clearCalender() this.$refs.left && this.$refs.left.clearCalender()
this.$refs.right && this.$refs.right.clearCalender() this.$refs.right && this.$refs.right.clearCalender()
this.$refs.right && this.$refs.right.next() this.$refs.right && this.$refs.right.changeMonth('next')
} }
if (needEmit) { if (needEmit) {
this.$emit('change', []) this.$emit('change', [])
...@@ -742,64 +827,43 @@ ...@@ -742,64 +827,43 @@
} }
}, },
parseDate(date) { calendarClick(e) {
date = this.fixIosDateFormat(date) this.$emit('calendarClick', e)
const defVal = new Date(date)
const year = defVal.getFullYear()
const month = defVal.getMonth() + 1
const day = defVal.getDate()
const hour = defVal.getHours()
const minute = defVal.getMinutes()
const second = defVal.getSeconds()
const defDate = year + '-' + this.lessTen(month) + '-' + this.lessTen(day)
const defTime = this.lessTen(hour) + ':' + this.lessTen(minute) + (this.hideSecond ? '' : (':' + this
.lessTen(second)))
return {
defDate,
defTime
}
},
lessTen(item) {
return item < 10 ? '0' + item : item
},
//兼容 iOS、safari 日期格式
fixIosDateFormat(value) {
if (typeof value === 'string') {
value = value.replace(/-/g, '/')
}
return value
},
leftMonthSwitch(e) {
// console.log('leftMonthSwitch 返回:', e)
},
rightMonthSwitch(e) {
// console.log('rightMonthSwitch 返回:', e)
} }
} }
} }
</script> </script>
<style> <style lang="scss">
$uni-primary: #007aff !default;
.uni-date { .uni-date {
/* #ifndef APP-NVUE */
width: 100%; width: 100%;
/* #endif */
flex: 1; flex: 1;
} }
.uni-date-x { .uni-date-x {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 10px;
border-radius: 4px; border-radius: 4px;
background-color: #fff; background-color: #fff;
color: #666; color: #666;
font-size: 14px; font-size: 14px;
flex: 1; flex: 1;
.icon-calendar {
padding-left: 3px;
}
.range-separator {
height: 35px;
/* #ifndef MP */
padding: 0 2px;
/* #endif */
line-height: 35px;
}
} }
.uni-date-x--border { .uni-date-x--border {
...@@ -815,7 +879,7 @@ ...@@ -815,7 +879,7 @@
} }
.uni-date-editor--x .uni-date__icon-clear { .uni-date-editor--x .uni-date__icon-clear {
padding: 0 5px; padding-right: 3px;
display: flex; display: flex;
align-items: center; align-items: center;
/* #ifdef H5 */ /* #ifdef H5 */
...@@ -824,19 +888,19 @@ ...@@ -824,19 +888,19 @@
} }
.uni-date__x-input { .uni-date__x-input {
padding: 0 8px;
/* #ifndef APP-NVUE */
width: auto; width: auto;
height: 35px;
/* #ifndef MP */
padding-left: 5px;
/* #endif */ /* #endif */
position: relative; position: relative;
overflow: hidden;
flex: 1; flex: 1;
line-height: 1; line-height: 35px;
font-size: 14px; font-size: 14px;
height: 35px; overflow: hidden;
} }
.t-c { .text-center {
text-align: center; text-align: center;
} }
...@@ -854,17 +918,9 @@ ...@@ -854,17 +918,9 @@
.uni-date-picker__container { .uni-date-picker__container {
position: relative; position: relative;
/* position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
box-sizing: border-box;
z-index: 996;
font-size: 14px; */
} }
.uni-date-mask { .uni-date-mask--pc {
position: fixed; position: fixed;
bottom: 0px; bottom: 0px;
top: 0px; top: 0px;
...@@ -876,7 +932,6 @@ ...@@ -876,7 +932,6 @@
} }
.uni-date-single--x { .uni-date-single--x {
/* padding: 0 8px; */
background-color: #fff; background-color: #fff;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -887,7 +942,6 @@ ...@@ -887,7 +942,6 @@
} }
.uni-date-range--x { .uni-date-range--x {
/* padding: 0 8px; */
background-color: #fff; background-color: #fff;
position: absolute; position: absolute;
top: 0; top: 0;
...@@ -914,7 +968,6 @@ ...@@ -914,7 +968,6 @@
display: flex; display: flex;
/* #endif */ /* #endif */
flex-direction: row; flex-direction: row;
/* justify-content: space-between; */
} }
.popup-x-header--datetime { .popup-x-header--datetime {
...@@ -934,41 +987,36 @@ ...@@ -934,41 +987,36 @@
border-top-color: #F1F1F1; border-top-color: #F1F1F1;
border-top-style: solid; border-top-style: solid;
border-top-width: 1px; border-top-width: 1px;
/* background-color: #fff; */
line-height: 40px; line-height: 40px;
text-align: right; text-align: right;
color: #666; color: #666;
} }
.popup-x-footer text:hover { .popup-x-footer text:hover {
color: #007aff; color: $uni-primary;
cursor: pointer; cursor: pointer;
opacity: 0.8; opacity: 0.8;
} }
.popup-x-footer .confirm { .popup-x-footer .confirm-text {
margin-left: 20px; margin-left: 20px;
color: #007aff; color: $uni-primary;
} }
.uni-date-changed { .uni-date-changed {
/* background-color: #fff; */
text-align: center; text-align: center;
color: #333; color: #333;
border-bottom-color: #F1F1F1; border-bottom-color: #F1F1F1;
border-bottom-style: solid; border-bottom-style: solid;
border-bottom-width: 1px; border-bottom-width: 1px;
/* padding: 0 50px; */
} }
.uni-date-changed--time text { .uni-date-changed--time text {
/* padding: 0 20px; */
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
} }
.uni-date-changed .uni-date-changed--time { .uni-date-changed .uni-date-changed--time {
/* display: flex; */
flex: 1; flex: 1;
} }
...@@ -988,9 +1036,8 @@ ...@@ -988,9 +1036,8 @@
display: block; display: block;
width: 0; width: 0;
height: 0; height: 0;
border-color: transparent; border: 6px solid transparent;
border-style: solid; border-top-width: 0;
border-width: 6px;
} }
.uni-popper__arrow { .uni-popper__arrow {
...@@ -998,7 +1045,6 @@ ...@@ -998,7 +1045,6 @@
top: -6px; top: -6px;
left: 10%; left: 10%;
margin-right: 3px; margin-right: 3px;
border-top-width: 0;
border-bottom-color: #EBEEF5; border-bottom-color: #EBEEF5;
} }
...@@ -1006,7 +1052,6 @@ ...@@ -1006,7 +1052,6 @@
content: " "; content: " ";
top: 1px; top: 1px;
margin-left: -6px; margin-left: -6px;
border-top-width: 0;
border-bottom-color: #fff; border-bottom-color: #fff;
} }
</style> </style>
class Calendar { class Calendar {
constructor({ constructor({
date,
selected, selected,
startDate, startDate,
endDate, endDate,
range, range,
// multipleStatus
} = {}) { } = {}) {
// 当前日期 // 当前日期
this.date = this.getDate(new Date()) // 当前初入日期 this.date = this.getDateObj(new Date()) // 当前初入日期
// 打点信息 // 打点信息
this.selected = selected || []; this.selected = selected || [];
// 范围开始 // 起始时间
this.startDate = startDate this.startDate = startDate
// 范围结束 // 终止时间
this.endDate = endDate this.endDate = endDate
// 是否范围选择
this.range = range this.range = range
// 多选状态 // 多选状态
this.cleanMultipleStatus() this.cleanMultipleStatus()
// 每周日期 // 每周日期
this.weeks = {} this.weeks = {}
// this._getWeek(this.date.fullDate)
// this.multipleStatus = multipleStatus
this.lastHover = false this.lastHover = false
} }
/** /**
...@@ -29,8 +26,8 @@ class Calendar { ...@@ -29,8 +26,8 @@ class Calendar {
* @param {Object} date * @param {Object} date
*/ */
setDate(date) { setDate(date) {
this.selectDate = this.getDate(date) const selectDate = this.getDateObj(date)
this._getWeek(this.selectDate.fullDate) this.getWeeks(selectDate.fullDate)
} }
/** /**
...@@ -44,93 +41,82 @@ class Calendar { ...@@ -44,93 +41,82 @@ class Calendar {
} }
} }
/** setStartDate(startDate) {
* 重置开始日期
*/
resetSatrtDate(startDate) {
// 范围开始
this.startDate = startDate this.startDate = startDate
} }
/** setEndDate(endDate) {
* 重置结束日期
*/
resetEndDate(endDate) {
// 范围结束
this.endDate = endDate this.endDate = endDate
} }
/** getPreMonthObj(date) {
* 获取任意时间 date = fixIosDateFormat(date)
*/ date = new Date(date)
getDate(date, AddDayCount = 0, str = 'day') {
if (!date) { const oldMonth = date.getMonth()
date = new Date() date.setMonth(oldMonth - 1)
} const newMonth = date.getMonth()
if (typeof date !== 'object') { if (oldMonth !== 0 && newMonth - oldMonth === 0) {
date = date.replace(/-/g, '/') date.setMonth(newMonth - 1)
} }
const dd = new Date(date) return this.getDateObj(date)
switch (str) { }
case 'day': getNextMonthObj(date) {
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期 date = fixIosDateFormat(date)
break date = new Date(date)
case 'month':
if (dd.getDate() === 31) { const oldMonth = date.getMonth()
dd.setDate(dd.getDate() + AddDayCount) date.setMonth(oldMonth + 1)
} else { const newMonth = date.getMonth()
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期 if (newMonth - oldMonth > 1) {
} date.setMonth(newMonth - 1)
break
case 'year':
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
break
} }
const y = dd.getFullYear() return this.getDateObj(date)
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0 }
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
/**
* 获取指定格式Date对象
*/
getDateObj(date) {
date = fixIosDateFormat(date)
date = new Date(date)
return { return {
fullDate: y + '-' + m + '-' + d, fullDate: getDate(date),
year: y, year: date.getFullYear(),
month: m, month: addZero(date.getMonth() + 1),
date: d, date: addZero(date.getDate()),
day: dd.getDay() day: date.getDay()
} }
} }
/** /**
* 获取上月剩余天数 * 获取上一个月日期集合
*/ */
_getLastMonthDays(firstDay, full) { getPreMonthDays(amount, dateObj) {
let dateArr = [] const result = []
for (let i = firstDay; i > 0; i--) { for (let i = amount - 1; i >= 0; i--) {
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate() const month = dateObj.month - 1
dateArr.push({ result.push({
date: beforeDate, date: new Date(dateObj.year, month, -i).getDate(),
month: full.month - 1, month,
disable: true disable: true
}) })
} }
return dateArr return result
} }
/** /**
* 获取本月天数 * 获取本月日期集合
*/ */
_currentMonthDys(dateData, full) { getCurrentMonthDays(amount, dateObj) {
let dateArr = [] const result = []
let fullDate = this.date.fullDate const fullDate = this.date.fullDate
for (let i = 1; i <= dateData; i++) { for (let i = 1; i <= amount; i++) {
let isinfo = false const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`
let nowDate = full.year + '-' + (full.month < 10 ? const isToday = fullDate === currentDate
full.month : full.month) + '-' + (i < 10 ?
'0' + i : i)
// 是否今天
let isDay = fullDate === nowDate
// 获取打点信息 // 获取打点信息
let info = this.selected && this.selected.find((item) => { const info = this.selected && this.selected.find((item) => {
if (this.dateEqual(nowDate, item.date)) { if (this.dateEqual(currentDate, item.date)) {
return item return item
} }
}) })
...@@ -139,62 +125,53 @@ class Calendar { ...@@ -139,62 +125,53 @@ class Calendar {
let disableBefore = true let disableBefore = true
let disableAfter = true let disableAfter = true
if (this.startDate) { if (this.startDate) {
// let dateCompBefore = this.dateCompare(this.startDate, fullDate) disableBefore = dateCompare(this.startDate, currentDate)
// disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
disableBefore = this.dateCompare(this.startDate, nowDate)
} }
if (this.endDate) { if (this.endDate) {
// let dateCompAfter = this.dateCompare(fullDate, this.endDate) disableAfter = dateCompare(currentDate, this.endDate)
// disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
disableAfter = this.dateCompare(nowDate, this.endDate)
} }
let multiples = this.multipleStatus.data let multiples = this.multipleStatus.data
let checked = false
let multiplesStatus = -1 let multiplesStatus = -1
if (this.range) { if (this.range && multiples) {
if (multiples) { multiplesStatus = multiples.findIndex((item) => {
multiplesStatus = multiples.findIndex((item) => { return this.dateEqual(item, currentDate)
return this.dateEqual(item, nowDate) })
})
}
if (multiplesStatus !== -1) {
checked = true
}
} }
let data = { const checked = multiplesStatus !== -1
fullDate: nowDate,
year: full.year, result.push({
fullDate: currentDate,
year: dateObj.year,
date: i, date: i,
multiple: this.range ? checked : false, multiple: this.range ? checked : false,
beforeMultiple: this.isLogicBefore(nowDate, this.multipleStatus.before, this.multipleStatus.after), beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
afterMultiple: this.isLogicAfter(nowDate, this.multipleStatus.before, this.multipleStatus.after), afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
month: full.month, month: dateObj.month,
disable: !(disableBefore && disableAfter), disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(
isDay, currentDate, this.endDate)),
userChecked: false isToday,
} userChecked: false,
if (info) { extraInfo: info
data.extraInfo = info })
}
dateArr.push(data)
} }
return dateArr return result
} }
/** /**
* 获取下月天数 * 获取下一个月日期集合
*/ */
_getNextMonthDays(surplus, full) { _getNextMonthDays(amount, dateObj) {
let dateArr = [] const result = []
for (let i = 1; i < surplus + 1; i++) { const month = dateObj.month + 1
dateArr.push({ for (let i = 1; i <= amount; i++) {
result.push({
date: i, date: i,
month: Number(full.month) + 1, month,
disable: true disable: true
}) })
} }
return dateArr return result
} }
/** /**
...@@ -205,58 +182,37 @@ class Calendar { ...@@ -205,58 +182,37 @@ class Calendar {
if (!date) { if (!date) {
date = new Date() date = new Date()
} }
const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate)
return dateInfo
}
/** return this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate)
* 比较时间大小
*/
dateCompare(startDate, endDate) {
// 计算截止时间
startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
// 计算详细项的截止时间
endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
if (startDate <= endDate) {
return true
} else {
return false
}
} }
/** /**
* 比较时间是否相等 * 比较时间是否相等
*/ */
dateEqual(before, after) { dateEqual(before, after) {
// 计算截止时间 before = new Date(fixIosDateFormat(before))
before = new Date(before.replace('-', '/').replace('-', '/')) after = new Date(fixIosDateFormat(after))
// 计算详细项的截止时间 return before.valueOf() === after.valueOf()
after = new Date(after.replace('-', '/').replace('-', '/'))
if (before.getTime() - after.getTime() === 0) {
return true
} else {
return false
}
} }
/** /**
* 比较真实起始日期 * 比较真实起始日期
*/ */
isLogicBefore(currentDay, before, after) { isLogicBefore(currentDate, before, after) {
let logicBefore = before let logicBefore = before
if (before && after) { if (before && after) {
logicBefore = this.dateCompare(before, after) ? before : after logicBefore = dateCompare(before, after) ? before : after
} }
return this.dateEqual(logicBefore, currentDay) return this.dateEqual(logicBefore, currentDate)
} }
isLogicAfter(currentDay, before, after) { isLogicAfter(currentDate, before, after) {
let logicAfter = after let logicAfter = after
if (before && after) { if (before && after) {
logicAfter = this.dateCompare(before, after) ? after : before logicAfter = dateCompare(before, after) ? after : before
} }
return this.dateEqual(logicAfter, currentDay) return this.dateEqual(logicAfter, currentDate)
} }
/** /**
...@@ -276,7 +232,7 @@ class Calendar { ...@@ -276,7 +232,7 @@ class Calendar {
var unixDe = de.getTime() - 24 * 60 * 60 * 1000 var unixDe = de.getTime() - 24 * 60 * 60 * 1000
for (var k = unixDb; k <= unixDe;) { for (var k = unixDb; k <= unixDe;) {
k = k + 24 * 60 * 60 * 1000 k = k + 24 * 60 * 60 * 1000
arr.push(this.getDate(new Date(parseInt(k))).fullDate) arr.push(this.getDateObj(new Date(parseInt(k))).fullDate)
} }
return arr return arr
} }
...@@ -285,11 +241,12 @@ class Calendar { ...@@ -285,11 +241,12 @@ class Calendar {
* 获取多选状态 * 获取多选状态
*/ */
setMultiple(fullDate) { setMultiple(fullDate) {
if (!this.range) return
let { let {
before, before,
after after
} = this.multipleStatus } = this.multipleStatus
if (!this.range) return
if (before && after) { if (before && after) {
if (!this.lastHover) { if (!this.lastHover) {
this.lastHover = true this.lastHover = true
...@@ -303,10 +260,11 @@ class Calendar { ...@@ -303,10 +260,11 @@ class Calendar {
} else { } else {
if (!before) { if (!before) {
this.multipleStatus.before = fullDate this.multipleStatus.before = fullDate
this.multipleStatus.after = undefined;
this.lastHover = false this.lastHover = false
} else { } else {
this.multipleStatus.after = fullDate this.multipleStatus.after = fullDate
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus
.after); .after);
} else { } else {
...@@ -316,32 +274,33 @@ class Calendar { ...@@ -316,32 +274,33 @@ class Calendar {
this.lastHover = true this.lastHover = true
} }
} }
this._getWeek(fullDate) this.getWeeks(fullDate)
} }
/** /**
* 鼠标 hover 更新多选状态 * 鼠标 hover 更新多选状态
*/ */
setHoverMultiple(fullDate) { setHoverMultiple(fullDate) {
let { //抖音小程序点击会触发hover事件,需要避免一下
before, // #ifndef MP-TOUTIAO
after if (!this.range || this.lastHover) return
const {
before
} = this.multipleStatus } = this.multipleStatus
if (!this.range) return
if (this.lastHover) return
if (!before) { if (!before) {
this.multipleStatus.before = fullDate this.multipleStatus.before = fullDate
} else { } else {
this.multipleStatus.after = fullDate this.multipleStatus.after = fullDate
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) { if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after); this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else { } else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before); this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
} }
} }
this._getWeek(fullDate) this.getWeeks(fullDate)
// #endif
} }
/** /**
...@@ -351,12 +310,12 @@ class Calendar { ...@@ -351,12 +310,12 @@ class Calendar {
this.multipleStatus.before = before this.multipleStatus.before = before
this.multipleStatus.after = after this.multipleStatus.after = after
if (before && after) { if (before && after) {
if (this.dateCompare(before, after)) { if (dateCompare(before, after)) {
this.multipleStatus.data = this.geDateAll(before, after); this.multipleStatus.data = this.geDateAll(before, after);
this._getWeek(after) this.getWeeks(after)
} else { } else {
this.multipleStatus.data = this.geDateAll(after, before); this.multipleStatus.data = this.geDateAll(after, before);
this._getWeek(before) this.getWeeks(before)
} }
} }
} }
...@@ -365,46 +324,98 @@ class Calendar { ...@@ -365,46 +324,98 @@ class Calendar {
* 获取每周数据 * 获取每周数据
* @param {Object} dateData * @param {Object} dateData
*/ */
_getWeek(dateData) { getWeeks(dateData) {
const { const {
fullDate,
year, year,
month, month,
date, } = this.getDateObj(dateData)
day
} = this.getDate(dateData) const preMonthDayAmount = new Date(year, month - 1, 1).getDay()
let firstDay = new Date(year, month - 1, 1).getDay() const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData))
let currentDay = new Date(year, month, 0).getDate()
let dates = { const currentMonthDayAmount = new Date(year, month, 0).getDate()
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天 const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData))
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)), // 本月天数
nextMonthDays: [], // 下个月开始几天 const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount
weeks: [] const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData))
}
let canlender = [] const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays]
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length)
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData)) const weeks = new Array(6)
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays) for (let i = 0; i < calendarDays.length; i++) {
let weeks = {} const index = Math.floor(i / 7)
// 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天 if (!weeks[index]) {
for (let i = 0; i < canlender.length; i++) { weeks[index] = new Array(7)
if (i % 7 === 0) {
weeks[parseInt(i / 7)] = new Array(7)
} }
weeks[parseInt(i / 7)][i % 7] = canlender[i] weeks[index][i % 7] = calendarDays[i]
} }
this.canlender = canlender
this.calendar = calendarDays
this.weeks = weeks this.weeks = weeks
} }
}
function getDateTime(date, hideSecond) {
return `${getDate(date)} ${getTime(date, hideSecond)}`
}
function getDate(date) {
date = fixIosDateFormat(date)
date = new Date(date)
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
return `${year}-${addZero(month)}-${addZero(day)}`
}
//静态方法 function getTime(date, hideSecond) {
// static init(date) { date = fixIosDateFormat(date)
// if (!this.instance) { date = new Date(date)
// this.instance = new Calendar(date); const hour = date.getHours()
// } const minute = date.getMinutes()
// return this.instance; const second = date.getSeconds()
// } return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`
} }
function addZero(num) {
if (num < 10) {
num = `0${num}`
}
return num
}
function getDefaultSecond(hideSecond) {
return hideSecond ? '00:00' : '00:00:00'
}
export default Calendar function dateCompare(startDate, endDate) {
startDate = new Date(fixIosDateFormat(startDate))
endDate = new Date(fixIosDateFormat(endDate))
return startDate <= endDate
}
function checkDate(date) {
const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g
return date.match(dateReg)
}
//ios低版本15及以下,无法匹配 没有 ’秒‘ 时的情况,所以需要在末尾 秒 加上 问号
const dateTimeReg = /^\d{4}-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])( [0-5]?[0-9]:[0-5]?[0-9](:[0-5]?[0-9])?)?$/;
function fixIosDateFormat(value) {
if (typeof value === 'string' && dateTimeReg.test(value)) {
value = value.replace(/-/g, '/')
}
return value
}
export {
Calendar,
getDateTime,
getDate,
getTime,
addZero,
getDefaultSecond,
dateCompare,
checkDate,
fixIosDateFormat
}
{ {
"id": "uni-datetime-picker", "id": "uni-datetime-picker",
"displayName": "uni-datetime-picker 日期选择器", "displayName": "uni-datetime-picker 日期选择器",
"version": "2.2.6", "version": "2.2.34",
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择", "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
"keywords": [ "keywords": [
"uni-datetime-picker", "uni-datetime-picker",
...@@ -17,11 +17,7 @@ ...@@ -17,11 +17,7 @@
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
...@@ -38,7 +34,8 @@ ...@@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
...@@ -49,7 +46,8 @@ ...@@ -49,7 +46,8 @@
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y",
"alipay": "n"
}, },
"client": { "client": {
"App": { "App": {
......
## 2.0.10(2024-06-07)
- 优化 uni-app x 中,size 属性的类型
## 2.0.9(2024-01-12)
fix: 修复图标大小默认值错误的问题
## 2.0.8(2023-12-14)
- 修复 项目未使用 ts 情况下,打包报错的bug
## 2.0.7(2023-12-14)
- 修复 size 属性为 string 时,不加单位导致尺寸异常的bug
## 2.0.6(2023-12-11)
- 优化 兼容老版本icon类型,如 top ,bottom 等
## 2.0.5(2023-12-11)
- 优化 兼容老版本icon类型,如 top ,bottom 等
## 2.0.4(2023-12-06)
- 优化 uni-app x 下示例项目图标排序
## 2.0.3(2023-12-06)
- 修复 nvue下引入组件报错的bug
## 2.0.2(2023-12-05)
-优化 size 属性支持单位
## 2.0.1(2023-12-05)
- 新增 uni-app x 支持定义图标
## 1.3.5(2022-01-24) ## 1.3.5(2022-01-24)
- 优化 size 属性可以传入不带单位的字符串数值 - 优化 size 属性可以传入不带单位的字符串数值
## 1.3.4(2022-01-24) ## 1.3.4(2022-01-24)
......
<template>
<text class="uni-icons" :style="styleObj">
<slot>{{unicode}}</slot>
</text>
</template>
<script>
import { fontData, IconsDataItem } from './uniicons_file'
/**
* Icons 图标
* @description 用于展示 icon 图标
* @tutorial https://ext.dcloud.net.cn/plugin?id=28
* @property {Number,String} size 图标大小
* @property {String} type 图标图案,参考示例
* @property {String} color 图标颜色
* @property {String} customPrefix 自定义图标
* @event {Function} click 点击 Icon 触发事件
*/
export default {
name: "uni-icons",
props: {
type: {
type: String,
default: ''
},
color: {
type: String,
default: '#333333'
},
size: {
type: [Number, String],
default: 16
},
fontFamily: {
type: String,
default: ''
}
},
data() {
return {};
},
computed: {
unicode() : string {
let codes = fontData.find((item : IconsDataItem) : boolean => { return item.font_class == this.type })
if (codes !== null) {
return codes.unicode
}
return ''
},
iconSize() : string {
const size = this.size
if (typeof size == 'string') {
const reg = /^[0-9]*$/g
return reg.test(size as string) ? '' + size + 'px' : '' + size;
// return '' + this.size
}
return this.getFontSize(size as number)
},
styleObj() : UTSJSONObject {
if (this.fontFamily !== '') {
return { color: this.color, fontSize: this.iconSize, fontFamily: this.fontFamily }
}
return { color: this.color, fontSize: this.iconSize }
}
},
created() { },
methods: {
/**
* 字体大小
*/
getFontSize(size : number) : string {
return size + 'px';
},
},
}
</script>
<style scoped>
@font-face {
font-family: UniIconsFontFamily;
src: url('./uniicons.ttf');
}
.uni-icons {
font-family: UniIconsFontFamily;
font-size: 18px;
font-style: normal;
color: #333;
}
</style>
<template> <template>
<!-- #ifdef APP-NVUE --> <!-- #ifdef APP-NVUE -->
<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" @click="_onClick">{{unicode}}</text> <text :style="styleObj" class="uni-icons" @click="_onClick">{{unicode}}</text>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<text :style="{ color: color, 'font-size': iconSize }" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick"></text> <text :style="styleObj" class="uni-icons" :class="['uniui-'+type,customPrefix,customPrefix?type:'']" @click="_onClick">
<slot></slot>
</text>
<!-- #endif --> <!-- #endif -->
</template> </template>
<script> <script>
import icons from './icons.js'; import { fontData } from './uniicons_file_vue.js';
const getVal = (val) => { const getVal = (val) => {
const reg = /^[0-9]*$/g const reg = /^[0-9]*$/g
return (typeof val === 'number' || reg.test(val) )? val + 'px' : val; return (typeof val === 'number' || reg.test(val)) ? val + 'px' : val;
} }
// #ifdef APP-NVUE // #ifdef APP-NVUE
var domModule = weex.requireModule('dom'); var domModule = weex.requireModule('dom');
import iconUrl from './uniicons.ttf' import iconUrl from './uniicons.ttf'
domModule.addRule('fontFace', { domModule.addRule('fontFace', {
'fontFamily': "uniicons", 'fontFamily': "uniicons",
'src': "url('"+iconUrl+"')" 'src': "url('" + iconUrl + "')"
}); });
// #endif // #endif
...@@ -34,7 +38,7 @@ ...@@ -34,7 +38,7 @@
*/ */
export default { export default {
name: 'UniIcons', name: 'UniIcons',
emits:['click'], emits: ['click'],
props: { props: {
type: { type: {
type: String, type: String,
...@@ -48,26 +52,36 @@ ...@@ -48,26 +52,36 @@
type: [Number, String], type: [Number, String],
default: 16 default: 16
}, },
customPrefix:{ customPrefix: {
type: String,
default: ''
},
fontFamily: {
type: String, type: String,
default: '' default: ''
} }
}, },
data() { data() {
return { return {
icons: icons.glyphs icons: fontData
} }
}, },
computed:{ computed: {
unicode(){ unicode() {
let code = this.icons.find(v=>v.font_class === this.type) let code = this.icons.find(v => v.font_class === this.type)
if(code){ if (code) {
return unescape(`%u${code.unicode}`) return code.unicode
} }
return '' return ''
}, },
iconSize(){ iconSize() {
return getVal(this.size) return getVal(this.size)
},
styleObj() {
if (this.fontFamily !== '') {
return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`
}
return `color: ${this.color}; font-size: ${this.iconSize};`
} }
}, },
methods: { methods: {
...@@ -81,9 +95,10 @@ ...@@ -81,9 +95,10 @@
<style lang="scss"> <style lang="scss">
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
@import './uniicons.css'; @import './uniicons.css';
@font-face { @font-face {
font-family: uniicons; font-family: uniicons;
src: url('./uniicons.ttf') format('truetype'); src: url('./uniicons.ttf');
} }
/* #endif */ /* #endif */
...@@ -92,5 +107,4 @@ ...@@ -92,5 +107,4 @@
text-decoration: none; text-decoration: none;
text-align: center; text-align: center;
} }
</style> </style>
.uniui-cart-filled:before {
content: "\e6d0";
}
.uniui-gift-filled:before {
content: "\e6c4";
}
.uniui-color:before { .uniui-color:before {
content: "\e6cf"; content: "\e6cf";
} }
...@@ -58,10 +67,6 @@ ...@@ -58,10 +67,6 @@
content: "\e6c3"; content: "\e6c3";
} }
.uniui-gift-filled:before {
content: "\e6c4";
}
.uniui-fire-filled:before { .uniui-fire-filled:before {
content: "\e6c5"; content: "\e6c5";
} }
...@@ -82,6 +87,18 @@ ...@@ -82,6 +87,18 @@
content: "\e698"; content: "\e698";
} }
.uniui-arrowthinleft:before {
content: "\e6d2";
}
.uniui-arrowthinup:before {
content: "\e6d3";
}
.uniui-arrowthindown:before {
content: "\e6d4";
}
.uniui-back:before { .uniui-back:before {
content: "\e6b9"; content: "\e6b9";
} }
...@@ -94,55 +111,43 @@ ...@@ -94,55 +111,43 @@
content: "\e6bb"; content: "\e6bb";
} }
.uniui-arrowthinright:before {
content: "\e6bb";
}
.uniui-arrow-left:before { .uniui-arrow-left:before {
content: "\e6bc"; content: "\e6bc";
} }
.uniui-arrowthinleft:before {
content: "\e6bc";
}
.uniui-arrow-up:before { .uniui-arrow-up:before {
content: "\e6bd"; content: "\e6bd";
} }
.uniui-arrowthinup:before {
content: "\e6bd";
}
.uniui-arrow-down:before { .uniui-arrow-down:before {
content: "\e6be"; content: "\e6be";
} }
.uniui-arrowthindown:before { .uniui-arrowthinright:before {
content: "\e6be"; content: "\e6d1";
} }
.uniui-bottom:before { .uniui-down:before {
content: "\e6b8"; content: "\e6b8";
} }
.uniui-arrowdown:before { .uniui-bottom:before {
content: "\e6b8"; content: "\e6b8";
} }
.uniui-right:before { .uniui-arrowright:before {
content: "\e6b5"; content: "\e6d5";
} }
.uniui-arrowright:before { .uniui-right:before {
content: "\e6b5"; content: "\e6b5";
} }
.uniui-top:before { .uniui-up:before {
content: "\e6b6"; content: "\e6b6";
} }
.uniui-arrowup:before { .uniui-top:before {
content: "\e6b6"; content: "\e6b6";
} }
...@@ -150,8 +155,8 @@ ...@@ -150,8 +155,8 @@
content: "\e6b7"; content: "\e6b7";
} }
.uniui-arrowleft:before { .uniui-arrowup:before {
content: "\e6b7"; content: "\e6d6";
} }
.uniui-eye:before { .uniui-eye:before {
...@@ -638,10 +643,6 @@ ...@@ -638,10 +643,6 @@
content: "\e627"; content: "\e627";
} }
.uniui-cart-filled:before {
content: "\e629";
}
.uniui-checkbox:before { .uniui-checkbox:before {
content: "\e62b"; content: "\e62b";
} }
......
export type IconsData = {
id : string
name : string
font_family : string
css_prefix_text : string
description : string
glyphs : Array<IconsDataItem>
}
export type IconsDataItem = {
font_class : string
unicode : string
}
export const fontData = [
{
"font_class": "arrow-down",
"unicode": "\ue6be"
},
{
"font_class": "arrow-left",
"unicode": "\ue6bc"
},
{
"font_class": "arrow-right",
"unicode": "\ue6bb"
},
{
"font_class": "arrow-up",
"unicode": "\ue6bd"
},
{
"font_class": "auth",
"unicode": "\ue6ab"
},
{
"font_class": "auth-filled",
"unicode": "\ue6cc"
},
{
"font_class": "back",
"unicode": "\ue6b9"
},
{
"font_class": "bars",
"unicode": "\ue627"
},
{
"font_class": "calendar",
"unicode": "\ue6a0"
},
{
"font_class": "calendar-filled",
"unicode": "\ue6c0"
},
{
"font_class": "camera",
"unicode": "\ue65a"
},
{
"font_class": "camera-filled",
"unicode": "\ue658"
},
{
"font_class": "cart",
"unicode": "\ue631"
},
{
"font_class": "cart-filled",
"unicode": "\ue6d0"
},
{
"font_class": "chat",
"unicode": "\ue65d"
},
{
"font_class": "chat-filled",
"unicode": "\ue659"
},
{
"font_class": "chatboxes",
"unicode": "\ue696"
},
{
"font_class": "chatboxes-filled",
"unicode": "\ue692"
},
{
"font_class": "chatbubble",
"unicode": "\ue697"
},
{
"font_class": "chatbubble-filled",
"unicode": "\ue694"
},
{
"font_class": "checkbox",
"unicode": "\ue62b"
},
{
"font_class": "checkbox-filled",
"unicode": "\ue62c"
},
{
"font_class": "checkmarkempty",
"unicode": "\ue65c"
},
{
"font_class": "circle",
"unicode": "\ue65b"
},
{
"font_class": "circle-filled",
"unicode": "\ue65e"
},
{
"font_class": "clear",
"unicode": "\ue66d"
},
{
"font_class": "close",
"unicode": "\ue673"
},
{
"font_class": "closeempty",
"unicode": "\ue66c"
},
{
"font_class": "cloud-download",
"unicode": "\ue647"
},
{
"font_class": "cloud-download-filled",
"unicode": "\ue646"
},
{
"font_class": "cloud-upload",
"unicode": "\ue645"
},
{
"font_class": "cloud-upload-filled",
"unicode": "\ue648"
},
{
"font_class": "color",
"unicode": "\ue6cf"
},
{
"font_class": "color-filled",
"unicode": "\ue6c9"
},
{
"font_class": "compose",
"unicode": "\ue67f"
},
{
"font_class": "contact",
"unicode": "\ue693"
},
{
"font_class": "contact-filled",
"unicode": "\ue695"
},
{
"font_class": "down",
"unicode": "\ue6b8"
},
{
"font_class": "bottom",
"unicode": "\ue6b8"
},
{
"font_class": "download",
"unicode": "\ue68d"
},
{
"font_class": "download-filled",
"unicode": "\ue681"
},
{
"font_class": "email",
"unicode": "\ue69e"
},
{
"font_class": "email-filled",
"unicode": "\ue69a"
},
{
"font_class": "eye",
"unicode": "\ue651"
},
{
"font_class": "eye-filled",
"unicode": "\ue66a"
},
{
"font_class": "eye-slash",
"unicode": "\ue6b3"
},
{
"font_class": "eye-slash-filled",
"unicode": "\ue6b4"
},
{
"font_class": "fire",
"unicode": "\ue6a1"
},
{
"font_class": "fire-filled",
"unicode": "\ue6c5"
},
{
"font_class": "flag",
"unicode": "\ue65f"
},
{
"font_class": "flag-filled",
"unicode": "\ue660"
},
{
"font_class": "folder-add",
"unicode": "\ue6a9"
},
{
"font_class": "folder-add-filled",
"unicode": "\ue6c8"
},
{
"font_class": "font",
"unicode": "\ue6a3"
},
{
"font_class": "forward",
"unicode": "\ue6ba"
},
{
"font_class": "gear",
"unicode": "\ue664"
},
{
"font_class": "gear-filled",
"unicode": "\ue661"
},
{
"font_class": "gift",
"unicode": "\ue6a4"
},
{
"font_class": "gift-filled",
"unicode": "\ue6c4"
},
{
"font_class": "hand-down",
"unicode": "\ue63d"
},
{
"font_class": "hand-down-filled",
"unicode": "\ue63c"
},
{
"font_class": "hand-up",
"unicode": "\ue63f"
},
{
"font_class": "hand-up-filled",
"unicode": "\ue63e"
},
{
"font_class": "headphones",
"unicode": "\ue630"
},
{
"font_class": "heart",
"unicode": "\ue639"
},
{
"font_class": "heart-filled",
"unicode": "\ue641"
},
{
"font_class": "help",
"unicode": "\ue679"
},
{
"font_class": "help-filled",
"unicode": "\ue674"
},
{
"font_class": "home",
"unicode": "\ue662"
},
{
"font_class": "home-filled",
"unicode": "\ue663"
},
{
"font_class": "image",
"unicode": "\ue670"
},
{
"font_class": "image-filled",
"unicode": "\ue678"
},
{
"font_class": "images",
"unicode": "\ue650"
},
{
"font_class": "images-filled",
"unicode": "\ue64b"
},
{
"font_class": "info",
"unicode": "\ue669"
},
{
"font_class": "info-filled",
"unicode": "\ue649"
},
{
"font_class": "left",
"unicode": "\ue6b7"
},
{
"font_class": "link",
"unicode": "\ue6a5"
},
{
"font_class": "list",
"unicode": "\ue644"
},
{
"font_class": "location",
"unicode": "\ue6ae"
},
{
"font_class": "location-filled",
"unicode": "\ue6af"
},
{
"font_class": "locked",
"unicode": "\ue66b"
},
{
"font_class": "locked-filled",
"unicode": "\ue668"
},
{
"font_class": "loop",
"unicode": "\ue633"
},
{
"font_class": "mail-open",
"unicode": "\ue643"
},
{
"font_class": "mail-open-filled",
"unicode": "\ue63a"
},
{
"font_class": "map",
"unicode": "\ue667"
},
{
"font_class": "map-filled",
"unicode": "\ue666"
},
{
"font_class": "map-pin",
"unicode": "\ue6ad"
},
{
"font_class": "map-pin-ellipse",
"unicode": "\ue6ac"
},
{
"font_class": "medal",
"unicode": "\ue6a2"
},
{
"font_class": "medal-filled",
"unicode": "\ue6c3"
},
{
"font_class": "mic",
"unicode": "\ue671"
},
{
"font_class": "mic-filled",
"unicode": "\ue677"
},
{
"font_class": "micoff",
"unicode": "\ue67e"
},
{
"font_class": "micoff-filled",
"unicode": "\ue6b0"
},
{
"font_class": "minus",
"unicode": "\ue66f"
},
{
"font_class": "minus-filled",
"unicode": "\ue67d"
},
{
"font_class": "more",
"unicode": "\ue64d"
},
{
"font_class": "more-filled",
"unicode": "\ue64e"
},
{
"font_class": "navigate",
"unicode": "\ue66e"
},
{
"font_class": "navigate-filled",
"unicode": "\ue67a"
},
{
"font_class": "notification",
"unicode": "\ue6a6"
},
{
"font_class": "notification-filled",
"unicode": "\ue6c1"
},
{
"font_class": "paperclip",
"unicode": "\ue652"
},
{
"font_class": "paperplane",
"unicode": "\ue672"
},
{
"font_class": "paperplane-filled",
"unicode": "\ue675"
},
{
"font_class": "person",
"unicode": "\ue699"
},
{
"font_class": "person-filled",
"unicode": "\ue69d"
},
{
"font_class": "personadd",
"unicode": "\ue69f"
},
{
"font_class": "personadd-filled",
"unicode": "\ue698"
},
{
"font_class": "personadd-filled-copy",
"unicode": "\ue6d1"
},
{
"font_class": "phone",
"unicode": "\ue69c"
},
{
"font_class": "phone-filled",
"unicode": "\ue69b"
},
{
"font_class": "plus",
"unicode": "\ue676"
},
{
"font_class": "plus-filled",
"unicode": "\ue6c7"
},
{
"font_class": "plusempty",
"unicode": "\ue67b"
},
{
"font_class": "pulldown",
"unicode": "\ue632"
},
{
"font_class": "pyq",
"unicode": "\ue682"
},
{
"font_class": "qq",
"unicode": "\ue680"
},
{
"font_class": "redo",
"unicode": "\ue64a"
},
{
"font_class": "redo-filled",
"unicode": "\ue655"
},
{
"font_class": "refresh",
"unicode": "\ue657"
},
{
"font_class": "refresh-filled",
"unicode": "\ue656"
},
{
"font_class": "refreshempty",
"unicode": "\ue6bf"
},
{
"font_class": "reload",
"unicode": "\ue6b2"
},
{
"font_class": "right",
"unicode": "\ue6b5"
},
{
"font_class": "scan",
"unicode": "\ue62a"
},
{
"font_class": "search",
"unicode": "\ue654"
},
{
"font_class": "settings",
"unicode": "\ue653"
},
{
"font_class": "settings-filled",
"unicode": "\ue6ce"
},
{
"font_class": "shop",
"unicode": "\ue62f"
},
{
"font_class": "shop-filled",
"unicode": "\ue6cd"
},
{
"font_class": "smallcircle",
"unicode": "\ue67c"
},
{
"font_class": "smallcircle-filled",
"unicode": "\ue665"
},
{
"font_class": "sound",
"unicode": "\ue684"
},
{
"font_class": "sound-filled",
"unicode": "\ue686"
},
{
"font_class": "spinner-cycle",
"unicode": "\ue68a"
},
{
"font_class": "staff",
"unicode": "\ue6a7"
},
{
"font_class": "staff-filled",
"unicode": "\ue6cb"
},
{
"font_class": "star",
"unicode": "\ue688"
},
{
"font_class": "star-filled",
"unicode": "\ue68f"
},
{
"font_class": "starhalf",
"unicode": "\ue683"
},
{
"font_class": "trash",
"unicode": "\ue687"
},
{
"font_class": "trash-filled",
"unicode": "\ue685"
},
{
"font_class": "tune",
"unicode": "\ue6aa"
},
{
"font_class": "tune-filled",
"unicode": "\ue6ca"
},
{
"font_class": "undo",
"unicode": "\ue64f"
},
{
"font_class": "undo-filled",
"unicode": "\ue64c"
},
{
"font_class": "up",
"unicode": "\ue6b6"
},
{
"font_class": "top",
"unicode": "\ue6b6"
},
{
"font_class": "upload",
"unicode": "\ue690"
},
{
"font_class": "upload-filled",
"unicode": "\ue68e"
},
{
"font_class": "videocam",
"unicode": "\ue68c"
},
{
"font_class": "videocam-filled",
"unicode": "\ue689"
},
{
"font_class": "vip",
"unicode": "\ue6a8"
},
{
"font_class": "vip-filled",
"unicode": "\ue6c6"
},
{
"font_class": "wallet",
"unicode": "\ue6b1"
},
{
"font_class": "wallet-filled",
"unicode": "\ue6c2"
},
{
"font_class": "weibo",
"unicode": "\ue68b"
},
{
"font_class": "weixin",
"unicode": "\ue691"
}
] as IconsDataItem[]
// export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
export const fontData = [
{
"font_class": "arrow-down",
"unicode": "\ue6be"
},
{
"font_class": "arrow-left",
"unicode": "\ue6bc"
},
{
"font_class": "arrow-right",
"unicode": "\ue6bb"
},
{
"font_class": "arrow-up",
"unicode": "\ue6bd"
},
{
"font_class": "auth",
"unicode": "\ue6ab"
},
{
"font_class": "auth-filled",
"unicode": "\ue6cc"
},
{
"font_class": "back",
"unicode": "\ue6b9"
},
{
"font_class": "bars",
"unicode": "\ue627"
},
{
"font_class": "calendar",
"unicode": "\ue6a0"
},
{
"font_class": "calendar-filled",
"unicode": "\ue6c0"
},
{
"font_class": "camera",
"unicode": "\ue65a"
},
{
"font_class": "camera-filled",
"unicode": "\ue658"
},
{
"font_class": "cart",
"unicode": "\ue631"
},
{
"font_class": "cart-filled",
"unicode": "\ue6d0"
},
{
"font_class": "chat",
"unicode": "\ue65d"
},
{
"font_class": "chat-filled",
"unicode": "\ue659"
},
{
"font_class": "chatboxes",
"unicode": "\ue696"
},
{
"font_class": "chatboxes-filled",
"unicode": "\ue692"
},
{
"font_class": "chatbubble",
"unicode": "\ue697"
},
{
"font_class": "chatbubble-filled",
"unicode": "\ue694"
},
{
"font_class": "checkbox",
"unicode": "\ue62b"
},
{
"font_class": "checkbox-filled",
"unicode": "\ue62c"
},
{
"font_class": "checkmarkempty",
"unicode": "\ue65c"
},
{
"font_class": "circle",
"unicode": "\ue65b"
},
{
"font_class": "circle-filled",
"unicode": "\ue65e"
},
{
"font_class": "clear",
"unicode": "\ue66d"
},
{
"font_class": "close",
"unicode": "\ue673"
},
{
"font_class": "closeempty",
"unicode": "\ue66c"
},
{
"font_class": "cloud-download",
"unicode": "\ue647"
},
{
"font_class": "cloud-download-filled",
"unicode": "\ue646"
},
{
"font_class": "cloud-upload",
"unicode": "\ue645"
},
{
"font_class": "cloud-upload-filled",
"unicode": "\ue648"
},
{
"font_class": "color",
"unicode": "\ue6cf"
},
{
"font_class": "color-filled",
"unicode": "\ue6c9"
},
{
"font_class": "compose",
"unicode": "\ue67f"
},
{
"font_class": "contact",
"unicode": "\ue693"
},
{
"font_class": "contact-filled",
"unicode": "\ue695"
},
{
"font_class": "down",
"unicode": "\ue6b8"
},
{
"font_class": "bottom",
"unicode": "\ue6b8"
},
{
"font_class": "download",
"unicode": "\ue68d"
},
{
"font_class": "download-filled",
"unicode": "\ue681"
},
{
"font_class": "email",
"unicode": "\ue69e"
},
{
"font_class": "email-filled",
"unicode": "\ue69a"
},
{
"font_class": "eye",
"unicode": "\ue651"
},
{
"font_class": "eye-filled",
"unicode": "\ue66a"
},
{
"font_class": "eye-slash",
"unicode": "\ue6b3"
},
{
"font_class": "eye-slash-filled",
"unicode": "\ue6b4"
},
{
"font_class": "fire",
"unicode": "\ue6a1"
},
{
"font_class": "fire-filled",
"unicode": "\ue6c5"
},
{
"font_class": "flag",
"unicode": "\ue65f"
},
{
"font_class": "flag-filled",
"unicode": "\ue660"
},
{
"font_class": "folder-add",
"unicode": "\ue6a9"
},
{
"font_class": "folder-add-filled",
"unicode": "\ue6c8"
},
{
"font_class": "font",
"unicode": "\ue6a3"
},
{
"font_class": "forward",
"unicode": "\ue6ba"
},
{
"font_class": "gear",
"unicode": "\ue664"
},
{
"font_class": "gear-filled",
"unicode": "\ue661"
},
{
"font_class": "gift",
"unicode": "\ue6a4"
},
{
"font_class": "gift-filled",
"unicode": "\ue6c4"
},
{
"font_class": "hand-down",
"unicode": "\ue63d"
},
{
"font_class": "hand-down-filled",
"unicode": "\ue63c"
},
{
"font_class": "hand-up",
"unicode": "\ue63f"
},
{
"font_class": "hand-up-filled",
"unicode": "\ue63e"
},
{
"font_class": "headphones",
"unicode": "\ue630"
},
{
"font_class": "heart",
"unicode": "\ue639"
},
{
"font_class": "heart-filled",
"unicode": "\ue641"
},
{
"font_class": "help",
"unicode": "\ue679"
},
{
"font_class": "help-filled",
"unicode": "\ue674"
},
{
"font_class": "home",
"unicode": "\ue662"
},
{
"font_class": "home-filled",
"unicode": "\ue663"
},
{
"font_class": "image",
"unicode": "\ue670"
},
{
"font_class": "image-filled",
"unicode": "\ue678"
},
{
"font_class": "images",
"unicode": "\ue650"
},
{
"font_class": "images-filled",
"unicode": "\ue64b"
},
{
"font_class": "info",
"unicode": "\ue669"
},
{
"font_class": "info-filled",
"unicode": "\ue649"
},
{
"font_class": "left",
"unicode": "\ue6b7"
},
{
"font_class": "link",
"unicode": "\ue6a5"
},
{
"font_class": "list",
"unicode": "\ue644"
},
{
"font_class": "location",
"unicode": "\ue6ae"
},
{
"font_class": "location-filled",
"unicode": "\ue6af"
},
{
"font_class": "locked",
"unicode": "\ue66b"
},
{
"font_class": "locked-filled",
"unicode": "\ue668"
},
{
"font_class": "loop",
"unicode": "\ue633"
},
{
"font_class": "mail-open",
"unicode": "\ue643"
},
{
"font_class": "mail-open-filled",
"unicode": "\ue63a"
},
{
"font_class": "map",
"unicode": "\ue667"
},
{
"font_class": "map-filled",
"unicode": "\ue666"
},
{
"font_class": "map-pin",
"unicode": "\ue6ad"
},
{
"font_class": "map-pin-ellipse",
"unicode": "\ue6ac"
},
{
"font_class": "medal",
"unicode": "\ue6a2"
},
{
"font_class": "medal-filled",
"unicode": "\ue6c3"
},
{
"font_class": "mic",
"unicode": "\ue671"
},
{
"font_class": "mic-filled",
"unicode": "\ue677"
},
{
"font_class": "micoff",
"unicode": "\ue67e"
},
{
"font_class": "micoff-filled",
"unicode": "\ue6b0"
},
{
"font_class": "minus",
"unicode": "\ue66f"
},
{
"font_class": "minus-filled",
"unicode": "\ue67d"
},
{
"font_class": "more",
"unicode": "\ue64d"
},
{
"font_class": "more-filled",
"unicode": "\ue64e"
},
{
"font_class": "navigate",
"unicode": "\ue66e"
},
{
"font_class": "navigate-filled",
"unicode": "\ue67a"
},
{
"font_class": "notification",
"unicode": "\ue6a6"
},
{
"font_class": "notification-filled",
"unicode": "\ue6c1"
},
{
"font_class": "paperclip",
"unicode": "\ue652"
},
{
"font_class": "paperplane",
"unicode": "\ue672"
},
{
"font_class": "paperplane-filled",
"unicode": "\ue675"
},
{
"font_class": "person",
"unicode": "\ue699"
},
{
"font_class": "person-filled",
"unicode": "\ue69d"
},
{
"font_class": "personadd",
"unicode": "\ue69f"
},
{
"font_class": "personadd-filled",
"unicode": "\ue698"
},
{
"font_class": "personadd-filled-copy",
"unicode": "\ue6d1"
},
{
"font_class": "phone",
"unicode": "\ue69c"
},
{
"font_class": "phone-filled",
"unicode": "\ue69b"
},
{
"font_class": "plus",
"unicode": "\ue676"
},
{
"font_class": "plus-filled",
"unicode": "\ue6c7"
},
{
"font_class": "plusempty",
"unicode": "\ue67b"
},
{
"font_class": "pulldown",
"unicode": "\ue632"
},
{
"font_class": "pyq",
"unicode": "\ue682"
},
{
"font_class": "qq",
"unicode": "\ue680"
},
{
"font_class": "redo",
"unicode": "\ue64a"
},
{
"font_class": "redo-filled",
"unicode": "\ue655"
},
{
"font_class": "refresh",
"unicode": "\ue657"
},
{
"font_class": "refresh-filled",
"unicode": "\ue656"
},
{
"font_class": "refreshempty",
"unicode": "\ue6bf"
},
{
"font_class": "reload",
"unicode": "\ue6b2"
},
{
"font_class": "right",
"unicode": "\ue6b5"
},
{
"font_class": "scan",
"unicode": "\ue62a"
},
{
"font_class": "search",
"unicode": "\ue654"
},
{
"font_class": "settings",
"unicode": "\ue653"
},
{
"font_class": "settings-filled",
"unicode": "\ue6ce"
},
{
"font_class": "shop",
"unicode": "\ue62f"
},
{
"font_class": "shop-filled",
"unicode": "\ue6cd"
},
{
"font_class": "smallcircle",
"unicode": "\ue67c"
},
{
"font_class": "smallcircle-filled",
"unicode": "\ue665"
},
{
"font_class": "sound",
"unicode": "\ue684"
},
{
"font_class": "sound-filled",
"unicode": "\ue686"
},
{
"font_class": "spinner-cycle",
"unicode": "\ue68a"
},
{
"font_class": "staff",
"unicode": "\ue6a7"
},
{
"font_class": "staff-filled",
"unicode": "\ue6cb"
},
{
"font_class": "star",
"unicode": "\ue688"
},
{
"font_class": "star-filled",
"unicode": "\ue68f"
},
{
"font_class": "starhalf",
"unicode": "\ue683"
},
{
"font_class": "trash",
"unicode": "\ue687"
},
{
"font_class": "trash-filled",
"unicode": "\ue685"
},
{
"font_class": "tune",
"unicode": "\ue6aa"
},
{
"font_class": "tune-filled",
"unicode": "\ue6ca"
},
{
"font_class": "undo",
"unicode": "\ue64f"
},
{
"font_class": "undo-filled",
"unicode": "\ue64c"
},
{
"font_class": "up",
"unicode": "\ue6b6"
},
{
"font_class": "top",
"unicode": "\ue6b6"
},
{
"font_class": "upload",
"unicode": "\ue690"
},
{
"font_class": "upload-filled",
"unicode": "\ue68e"
},
{
"font_class": "videocam",
"unicode": "\ue68c"
},
{
"font_class": "videocam-filled",
"unicode": "\ue689"
},
{
"font_class": "vip",
"unicode": "\ue6a8"
},
{
"font_class": "vip-filled",
"unicode": "\ue6c6"
},
{
"font_class": "wallet",
"unicode": "\ue6b1"
},
{
"font_class": "wallet-filled",
"unicode": "\ue6c2"
},
{
"font_class": "weibo",
"unicode": "\ue68b"
},
{
"font_class": "weixin",
"unicode": "\ue691"
}
]
// export const fontData = JSON.parse<IconsDataItem>(fontDataJson)
{ {
"id": "uni-icons", "id": "uni-icons",
"displayName": "uni-icons 图标", "displayName": "uni-icons 图标",
"version": "1.3.5", "version": "2.0.10",
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。", "description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
...@@ -16,11 +16,7 @@ ...@@ -16,11 +16,7 @@
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
...@@ -37,7 +33,8 @@ ...@@ -37,7 +33,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-scss"], "dependencies": ["uni-scss"],
...@@ -45,12 +42,14 @@ ...@@ -45,12 +42,14 @@
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y",
"alipay": "n"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y",
"app-uvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
...@@ -70,11 +69,15 @@ ...@@ -70,11 +69,15 @@
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y",
"钉钉": "y",
"快手": "y",
"飞书": "y",
"京东": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "y",
"联盟": "u" "联盟": "y"
}, },
"Vue": { "Vue": {
"vue2": "y", "vue2": "y",
...@@ -83,4 +86,4 @@ ...@@ -83,4 +86,4 @@
} }
} }
} }
} }
\ No newline at end of file
## 1.2.4(2023-12-19)
- 修复 uni-tr只有一列时minWidth计算错误,列变化实时计算更新
## 1.2.3(2023-03-28)
- 修复 在vue3模式下可能会出现错误的问题
## 1.2.2(2022-11-29)
- 优化 主题样式
## 1.2.1(2022-06-06) ## 1.2.1(2022-06-06)
- 修复 微信小程序存在无使用组件的问题 - 修复 微信小程序存在无使用组件的问题
## 1.2.0(2021-11-19) ## 1.2.0(2021-11-19)
......
<template> <template>
<view class="uni-table-scroll" :class="{ 'table--border': border, 'border-none': !noData }"> <view class="uni-table-scroll" :class="{ 'table--border': border, 'border-none': !noData }">
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<table class="uni-table" border="0" cellpadding="0" cellspacing="0" :class="{ 'table--stripe': stripe }" :style="{ 'min-width': minWidth + 'px' }"> <table class="uni-table" border="0" cellpadding="0" cellspacing="0" :class="{ 'table--stripe': stripe }" :style="{ 'min-width': minWidth + 'px' }">
<slot></slot> <slot></slot>
<view v-if="noData" class="uni-table-loading"> <tr v-if="noData" class="uni-table-loading">
<view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view> <td class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</td>
</view> </tr>
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view> <view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
</table> </table>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<view class="uni-table" :style="{ 'min-width': minWidth + 'px' }" :class="{ 'table--stripe': stripe }"> <view class="uni-table" :style="{ 'min-width': minWidth + 'px' }" :class="{ 'table--stripe': stripe }">
<slot></slot> <slot></slot>
<view v-if="noData" class="uni-table-loading"> <view v-if="noData" class="uni-table-loading">
<view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view> <view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view>
</view> </view>
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view> <view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
</template> </template>
<script> <script>
...@@ -34,420 +34,422 @@ ...@@ -34,420 +34,422 @@
* @event {Function} selection-change 开启多选时,当选择项发生变化时会触发该事件 * @event {Function} selection-change 开启多选时,当选择项发生变化时会触发该事件
*/ */
export default { export default {
name: 'uniTable', name: 'uniTable',
options: { options: {
virtualHost: true virtualHost: true
}, },
emits: ['selection-change'], emits:['selection-change'],
props: { props: {
data: { data: {
type: Array, type: Array,
default() { default() {
return []; return []
} }
}, },
// 是否有竖线 // 是否有竖线
border: { border: {
type: Boolean, type: Boolean,
default: false default: false
}, },
// 是否显示斑马线 // 是否显示斑马线
stripe: { stripe: {
type: Boolean, type: Boolean,
default: false default: false
}, },
// 多选 // 多选
type: { type: {
type: String, type: String,
default: '' default: ''
}, },
// 没有更多数据 // 没有更多数据
emptyText: { emptyText: {
type: String, type: String,
default: '没有更多数据' default: '没有更多数据'
}, },
loading: { loading: {
type: Boolean, type: Boolean,
default: false default: false
}, },
rowKey: { rowKey: {
type: String, type: String,
default: '' default: ''
} }
}, },
data() { data() {
return { return {
noData: true, noData: true,
minWidth: 0, minWidth: 0,
multiTableHeads: [] multiTableHeads: []
}; }
}, },
watch: { watch: {
loading(val) {}, loading(val) {},
data(newVal) { data(newVal) {
let theadChildren = this.theadChildren; let theadChildren = this.theadChildren
let rowspan = 1; let rowspan = 1
if (this.theadChildren) { if (this.theadChildren) {
rowspan = this.theadChildren.rowspan; rowspan = this.theadChildren.rowspan
} }
// this.trChildren.length - rowspan // this.trChildren.length - rowspan
this.noData = false; this.noData = false
// this.noData = newVal.length === 0 // this.noData = newVal.length === 0
} }
}, },
created() { created() {
// 定义tr的实例数组 // 定义tr的实例数组
this.trChildren = []; this.trChildren = []
this.thChildren = []; this.thChildren = []
this.theadChildren = null; this.theadChildren = null
this.backData = []; this.backData = []
this.backIndexData = []; this.backIndexData = []
}, },
methods: { methods: {
isNodata() { isNodata() {
let theadChildren = this.theadChildren; let theadChildren = this.theadChildren
let rowspan = 1; let rowspan = 1
if (this.theadChildren) { if (this.theadChildren) {
rowspan = this.theadChildren.rowspan; rowspan = this.theadChildren.rowspan
} }
this.noData = this.trChildren.length - rowspan <= 0; this.noData = this.trChildren.length - rowspan <= 0
}, },
/** /**
* 选中所有 * 选中所有
*/ */
selectionAll() { selectionAll() {
let startIndex = 1; let startIndex = 1
let theadChildren = this.theadChildren; let theadChildren = this.theadChildren
if (!this.theadChildren) { if (!this.theadChildren) {
theadChildren = this.trChildren[0]; theadChildren = this.trChildren[0]
} else { } else {
startIndex = theadChildren.rowspan - 1; startIndex = theadChildren.rowspan - 1
} }
let isHaveData = this.data && this.data.length.length > 0; let isHaveData = this.data && this.data.length > 0
theadChildren.checked = true; theadChildren.checked = true
theadChildren.indeterminate = false; theadChildren.indeterminate = false
this.trChildren.forEach((item, index) => { this.trChildren.forEach((item, index) => {
if (!item.disabled) { if (!item.disabled) {
item.checked = true; item.checked = true
if (isHaveData && item.keyValue) { if (isHaveData && item.keyValue) {
const row = this.data.find(v => v[this.rowKey] === item.keyValue); const row = this.data.find(v => v[this.rowKey] === item.keyValue)
if (!this.backData.find(v => v[this.rowKey] === row[this.rowKey])) { if (!this.backData.find(v => v[this.rowKey] === row[this.rowKey])) {
this.backData.push(row); this.backData.push(row)
} }
} }
if (index > startIndex - 1 && this.backIndexData.indexOf(index - startIndex) === -1) { if (index > (startIndex - 1) && this.backIndexData.indexOf(index - startIndex) === -1) {
this.backIndexData.push(index - startIndex); this.backIndexData.push(index - startIndex)
} }
} }
}); })
// this.backData = JSON.parse(JSON.stringify(this.data)) // this.backData = JSON.parse(JSON.stringify(this.data))
this.$emit('selection-change', { this.$emit('selection-change', {
detail: { detail: {
value: this.backData, value: this.backData,
index: this.backIndexData index: this.backIndexData
} }
}); })
}, },
/** /**
* 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中) * 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中)
*/ */
toggleRowSelection(row, selected) { toggleRowSelection(row, selected) {
// if (!this.theadChildren) return // if (!this.theadChildren) return
row = [].concat(row); row = [].concat(row)
this.trChildren.forEach((item, index) => { this.trChildren.forEach((item, index) => {
// if (item.keyValue) { // if (item.keyValue) {
const select = row.findIndex(v => { const select = row.findIndex(v => {
// //
if (typeof v === 'number') { if (typeof v === 'number') {
return v === index - 1; return v === index - 1
} else { } else {
return v[this.rowKey] === item.keyValue; return v[this.rowKey] === item.keyValue
} }
}); })
let ischeck = item.checked; let ischeck = item.checked
if (select !== -1) { if (select !== -1) {
if (typeof selected === 'boolean') { if (typeof selected === 'boolean') {
item.checked = selected; item.checked = selected
} else { } else {
item.checked = !item.checked; item.checked = !item.checked
} }
if (ischeck !== item.checked) { if (ischeck !== item.checked) {
this.check(item.rowData || item, item.checked, item.rowData ? item.keyValue : null, true); this.check(item.rowData||item, item.checked, item.rowData?item.keyValue:null, true)
} }
} }
// } // }
}); })
this.$emit('selection-change', { this.$emit('selection-change', {
detail: { detail: {
value: this.backData, value: this.backData,
index: this.backIndexData index:this.backIndexData
} }
}); })
}, },
/** /**
* 用于多选表格,清空用户的选择 * 用于多选表格,清空用户的选择
*/ */
clearSelection() { clearSelection() {
let theadChildren = this.theadChildren; let theadChildren = this.theadChildren
if (!this.theadChildren) { if (!this.theadChildren) {
theadChildren = this.trChildren[0]; theadChildren = this.trChildren[0]
} }
// if (!this.theadChildren) return // if (!this.theadChildren) return
theadChildren.checked = false; theadChildren.checked = false
theadChildren.indeterminate = false; theadChildren.indeterminate = false
this.trChildren.forEach(item => { this.trChildren.forEach(item => {
// if (item.keyValue) { // if (item.keyValue) {
item.checked = false; item.checked = false
// } // }
}); })
this.backData = []; this.backData = []
this.backIndexData = []; this.backIndexData = []
this.$emit('selection-change', { this.$emit('selection-change', {
detail: { detail: {
value: [], value: [],
index: [] index: []
} }
}); })
}, },
/** /**
* 用于多选表格,切换所有行的选中状态 * 用于多选表格,切换所有行的选中状态
*/ */
toggleAllSelection() { toggleAllSelection() {
let list = []; let list = []
let startIndex = 1; let startIndex = 1
let theadChildren = this.theadChildren; let theadChildren = this.theadChildren
if (!this.theadChildren) { if (!this.theadChildren) {
theadChildren = this.trChildren[0]; theadChildren = this.trChildren[0]
} else { } else {
startIndex = theadChildren.rowspan - 1; startIndex = theadChildren.rowspan - 1
} }
this.trChildren.forEach((item, index) => { this.trChildren.forEach((item, index) => {
if (!item.disabled) { if (!item.disabled) {
if (index > startIndex - 1) { if (index > (startIndex - 1) ) {
list.push(index - startIndex); list.push(index-startIndex)
} }
} }
}); })
this.toggleRowSelection(list); this.toggleRowSelection(list)
}, },
/** /**
* 选中\取消选中 * 选中\取消选中
* @param {Object} child * @param {Object} child
* @param {Object} check * @param {Object} check
* @param {Object} rowValue * @param {Object} rowValue
*/ */
check(child, check, keyValue, emit) { check(child, check, keyValue, emit) {
let theadChildren = this.theadChildren; let theadChildren = this.theadChildren
if (!this.theadChildren) { if (!this.theadChildren) {
theadChildren = this.trChildren[0]; theadChildren = this.trChildren[0]
} }
let childDomIndex = this.trChildren.findIndex((item, index) => child === item);
if (childDomIndex < 0) {
childDomIndex = this.data.findIndex(v => v[this.rowKey] === keyValue) + 1; let childDomIndex = this.trChildren.findIndex((item, index) => child === item)
} if(childDomIndex < 0){
const dataLen = this.trChildren.filter(v => !v.disabled && v.keyValue).length; childDomIndex = this.data.findIndex(v=>v[this.rowKey] === keyValue) + 1
if (childDomIndex === 0) { }
check ? this.selectionAll() : this.clearSelection(); const dataLen = this.trChildren.filter(v => !v.disabled && v.keyValue).length
return; if (childDomIndex === 0) {
} check ? this.selectionAll() : this.clearSelection()
return
if (check) { }
if (keyValue) {
this.backData.push(child); if (check) {
} if (keyValue) {
this.backIndexData.push(childDomIndex - 1); this.backData.push(child)
} else { }
const index = this.backData.findIndex(v => v[this.rowKey] === keyValue); this.backIndexData.push(childDomIndex - 1)
const idx = this.backIndexData.findIndex(item => item === childDomIndex - 1); } else {
if (keyValue) { const index = this.backData.findIndex(v => v[this.rowKey] === keyValue)
this.backData.splice(index, 1); const idx = this.backIndexData.findIndex(item => item === childDomIndex - 1)
} if (keyValue) {
this.backIndexData.splice(idx, 1); this.backData.splice(index, 1)
} }
this.backIndexData.splice(idx, 1)
const domCheckAll = this.trChildren.find((item, index) => index > 0 && !item.checked && !item.disabled); }
if (!domCheckAll) {
theadChildren.indeterminate = false; const domCheckAll = this.trChildren.find((item, index) => index > 0 && !item.checked && !item.disabled)
theadChildren.checked = true; if (!domCheckAll) {
} else { theadChildren.indeterminate = false
theadChildren.indeterminate = true; theadChildren.checked = true
theadChildren.checked = false; } else {
} theadChildren.indeterminate = true
theadChildren.checked = false
if (this.backIndexData.length === 0) { }
theadChildren.indeterminate = false;
} if (this.backIndexData.length === 0) {
theadChildren.indeterminate = false
if (!emit) { }
this.$emit('selection-change', {
detail: { if (!emit) {
value: this.backData, this.$emit('selection-change', {
index: this.backIndexData detail: {
} value: this.backData,
}); index: this.backIndexData
} }
} })
} }
}; }
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
$border-color: #ebeef5; $border-color: #ebeef5;
.uni-table-scroll { .uni-table-scroll {
width: 100%; width: 100%;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
overflow-x: hidden; overflow-x: auto;
/* #endif */ /* #endif */
} }
.uni-table { .uni-table {
position: relative; position: relative;
width: 100%; width: 100%;
border-radius: 5px; border-radius: 5px;
// box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.1); // box-shadow: 0px 0px 3px 1px rgba(0, 0, 0, 0.1);
background-color: #fff; background-color: #fff;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
box-sizing: border-box; box-sizing: border-box;
display: table; display: table;
overflow-x: hidden; overflow-x: auto;
::v-deep .uni-table-tr:nth-child(n + 2) { ::v-deep .uni-table-tr:nth-child(n + 2) {
&:hover { &:hover {
background-color: #f5f7fa; background-color: #f5f7fa;
} }
} }
::v-deep .uni-table-thead { ::v-deep .uni-table-thead {
.uni-table-tr { .uni-table-tr {
// background-color: #f5f7fa; // background-color: #f5f7fa;
&:hover { &:hover {
background-color: #fafafa; background-color:#fafafa;
} }
} }
} }
/* #endif */ /* #endif */
} }
.table--border { .table--border {
border: 1px $border-color solid; border: 1px $border-color solid;
border-right: none; border-right: none;
} }
.border-none { .border-none {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
border-bottom: none; border-bottom: none;
/* #endif */ /* #endif */
} }
.table--stripe { .table--stripe {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
::v-deep .uni-table-tr:nth-child(2n + 3) { ::v-deep .uni-table-tr:nth-child(2n + 3) {
background-color: #fafafa; background-color: #fafafa;
} }
/* #endif */ /* #endif */
} }
/* 表格加载、无数据样式 */ /* 表格加载、无数据样式 */
.uni-table-loading { .uni-table-loading {
position: relative; position: relative;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: table-row; display: table-row;
/* #endif */ /* #endif */
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
overflow: hidden; overflow: hidden;
box-sizing: border-box; box-sizing: border-box;
} }
.empty-border { .empty-border {
border-right: 1px $border-color solid; border-right: 1px $border-color solid;
} }
.uni-table-text { .uni-table-text {
position: absolute; position: absolute;
right: 0; right: 0;
left: 0; left: 0;
text-align: center; text-align: center;
font-size: 14px; font-size: 14px;
color: #999; color: #999;
} }
.uni-table-mask { .uni-table-mask {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
background-color: rgba(255, 255, 255, 0.8); background-color: rgba(255, 255, 255, 0.8);
z-index: 99; z-index: 99;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
margin: auto; margin: auto;
transition: all 0.5s; transition: all 0.5s;
/* #endif */ /* #endif */
justify-content: center; justify-content: center;
align-items: center; align-items: center;
} }
.uni-table--loader { .uni-table--loader {
width: 30px; width: 30px;
height: 30px; height: 30px;
border: 2px solid #aaa; border: 2px solid #aaa;
// border-bottom-color: transparent; // border-bottom-color: transparent;
border-radius: 50%; border-radius: 50%;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
animation: 2s uni-table--loader linear infinite; animation: 2s uni-table--loader linear infinite;
/* #endif */ /* #endif */
position: relative; position: relative;
} }
@keyframes uni-table--loader { @keyframes uni-table--loader {
0% { 0% {
transform: rotate(360deg); transform: rotate(360deg);
} }
10% { 10% {
border-left-color: transparent; border-left-color: transparent;
} }
20% { 20% {
border-bottom-color: transparent; border-bottom-color: transparent;
} }
30% { 30% {
border-right-color: transparent; border-right-color: transparent;
} }
40% { 40% {
border-top-color: transparent; border-top-color: transparent;
} }
50% { 50% {
transform: rotate(0deg); transform: rotate(0deg);
} }
60% { 60% {
border-top-color: transparent; border-top-color: transparent;
} }
70% { 70% {
border-left-color: transparent; border-left-color: transparent;
} }
80% { 80% {
border-bottom-color: transparent; border-bottom-color: transparent;
} }
90% { 90% {
border-right-color: transparent; border-right-color: transparent;
} }
100% { 100% {
transform: rotate(-360deg); transform: rotate(-360deg);
} }
} }
</style> </style>
<template> <template>
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<td class="uni-table-td" :rowspan="rowspan" :colspan="colspan" :class="{ 'table--border': border }" :style="{ width: width + 'px', 'text-align': align }"><slot></slot></td> <td class="uni-table-td" :rowspan="rowspan" :colspan="colspan" :class="{'table--border':border}" :style="{width:width + 'px','text-align':align}">
<!-- #endif --> <slot></slot>
<!-- #ifndef H5 --> </td>
<!-- :class="{'table--border':border}" --> <!-- #endif -->
<view class="uni-table-td" :class="{ 'table--border': border }" :style="{ width: width + 'px', 'text-align': align }"><slot></slot></view> <!-- #ifndef H5 -->
<!-- #endif --> <!-- :class="{'table--border':border}" -->
<view class="uni-table-td" :class="{'table--border':border}" :style="{width:width + 'px','text-align':align}">
<slot></slot>
</view>
<!-- #endif -->
</template> </template>
<script> <script>
/** /**
* Td 单元格 * Td 单元格
* @description 表格中的标准单元格组件 * @description 表格中的标准单元格组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=3270 * @tutorial https://ext.dcloud.net.cn/plugin?id=3270
* @property {Number} align = [left|center|right] 单元格对齐方式 * @property {Number} align = [left|center|right] 单元格对齐方式
*/ */
export default { export default {
name: 'uniTd', name: 'uniTd',
options: { options: {
virtualHost: true virtualHost: true
}, },
props: { props: {
width: { width: {
type: [String, Number], type: [String, Number],
default: '' default: ''
}, },
align: { align: {
type: String, type: String,
default: 'left' default: 'left'
}, },
rowspan: { rowspan: {
type: [Number, String], type: [Number,String],
default: 1 default: 1
}, },
colspan: { colspan: {
type: [Number, String], type: [Number,String],
default: 1 default: 1
} }
}, },
data() { data() {
return { return {
border: false border: false
}; };
}, },
created() { created() {
this.root = this.getTable(); this.root = this.getTable()
this.border = this.root.border; this.border = this.root.border
}, },
methods: { methods: {
/** /**
* 获取父元素实例 * 获取父元素实例
*/ */
getTable() { getTable() {
let parent = this.$parent; let parent = this.$parent;
let parentName = parent.$options.name; let parentName = parent.$options.name;
while (parentName !== 'uniTable') { while (parentName !== 'uniTable') {
parent = parent.$parent; parent = parent.$parent;
if (!parent) return false; if (!parent) return false;
parentName = parent.$options.name; parentName = parent.$options.name;
} }
return parent; return parent;
} },
} }
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
$border-color: #ebeef5; $border-color:#EBEEF5;
.uni-table-td { .uni-table-td {
display: table-cell; display: table-cell;
padding: 8px 10px; padding: 8px 10px;
font-size: 12px; font-size: 14px;
border-bottom: 1px $border-color solid; border-bottom: 1px $border-color solid;
font-weight: 400; font-weight: 400;
color: #606266; color: #606266;
line-height: 23px; line-height: 23px;
box-sizing: border-box; box-sizing: border-box;
word-break: break-word; }
}
.table--border { .table--border {
border-right: 1px $border-color solid; border-right: 1px $border-color solid;
} }
</style> </style>
...@@ -112,6 +112,12 @@ ...@@ -112,6 +112,12 @@
value: 'value' value: 'value'
} }
} }
},
filterDefaultValue: {
type: [Array,String],
default () {
return ""
}
} }
}, },
computed: { computed: {
...@@ -157,7 +163,7 @@ ...@@ -157,7 +163,7 @@
enabled: true, enabled: true,
isOpened: false, isOpened: false,
dataList: [], dataList: [],
filterValue: '', filterValue: this.filterDefaultValue,
checkedValues: [], checkedValues: [],
gtValue: '', gtValue: '',
ltValue: '', ltValue: '',
...@@ -286,6 +292,8 @@ ...@@ -286,6 +292,8 @@
</script> </script>
<style lang="scss"> <style lang="scss">
$uni-primary: #1890ff !default;
.flex-r { .flex-r {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
...@@ -315,8 +323,8 @@ ...@@ -315,8 +323,8 @@
} }
.icon-select.active { .icon-select.active {
background-color: #1890ff; background-color: $uni-primary;
border-top-color: #1890ff; border-top-color: $uni-primary;
} }
.icon-search { .icon-search {
...@@ -343,11 +351,11 @@ ...@@ -343,11 +351,11 @@
} }
.icon-search.active .icon-search-0 { .icon-search.active .icon-search-0 {
border-color: #1890ff; border-color: $uni-primary;
} }
.icon-search.active .icon-search-1 { .icon-search.active .icon-search-1 {
background-color: #1890ff; background-color: $uni-primary;
} }
.icon-calendar { .icon-calendar {
...@@ -387,14 +395,14 @@ ...@@ -387,14 +395,14 @@
} }
.icon-calendar.active { .icon-calendar.active {
color: #1890ff; color: $uni-primary;
} }
.icon-calendar.active .icon-calendar-0, .icon-calendar.active .icon-calendar-0,
.icon-calendar.active .icon-calendar-1, .icon-calendar.active .icon-calendar-1,
.icon-calendar.active .icon-calendar-0:before, .icon-calendar.active .icon-calendar-0:before,
.icon-calendar.active .icon-calendar-0:after { .icon-calendar.active .icon-calendar-0:after {
background-color: #1890ff; background-color: $uni-primary;
} }
.uni-filter-dropdown { .uni-filter-dropdown {
...@@ -497,7 +505,7 @@ ...@@ -497,7 +505,7 @@
} }
.btn-submit { .btn-submit {
background-color: #1890ff; background-color: $uni-primary;
color: #ffffff; color: #ffffff;
} }
</style> </style>
<template> <template>
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<th :rowspan="rowspan" :colspan="colspan" class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"> <th :rowspan="rowspan" :colspan="colspan" class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }">
<view class="uni-table-th-row"> <view class="uni-table-th-row">
<view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort"> <view class="uni-table-th-content" :style="{ 'justify-content': contentAlign }" @click="sort">
<slot></slot> <slot></slot>
<view v-if="sortable" class="arrow-box"> <view v-if="sortable" class="arrow-box">
<text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text> <text class="arrow up" :class="{ active: ascending }" @click.stop="ascendingFn"></text>
<text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text> <text class="arrow down" :class="{ active: descending }" @click.stop="descendingFn"></text>
</view> </view>
</view> </view>
<dropdown v-if="filterType || filterData.length" :filterData="filterData" :filterType="filterType" @change="ondropdown"></dropdown> <dropdown v-if="filterType || filterData.length" :filterDefaultValue="filterDefaultValue" :filterData="filterData" :filterType="filterType" @change="ondropdown"></dropdown>
</view> </view>
</th> </th>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"><slot></slot></view> <view class="uni-table-th" :class="{ 'table--border': border }" :style="{ width: customWidth + 'px', 'text-align': align }"><slot></slot></view>
<!-- #endif --> <!-- #endif -->
</template> </template>
<script> <script>
// #ifdef H5 // #ifdef H5
import dropdown from './filter-dropdown.vue'; import dropdown from './filter-dropdown.vue'
// #endif // #endif
/** /**
* Th 表头 * Th 表头
* @description 表格内的表头单元格组件 * @description 表格内的表头单元格组件
...@@ -39,244 +39,247 @@ import dropdown from './filter-dropdown.vue'; ...@@ -39,244 +39,247 @@ import dropdown from './filter-dropdown.vue';
* @event {Function} sort-change 排序触发事件 * @event {Function} sort-change 排序触发事件
*/ */
export default { export default {
name: 'uniTh', name: 'uniTh',
options: { options: {
virtualHost: true virtualHost: true
}, },
components: { components: {
// #ifdef H5 // #ifdef H5
dropdown dropdown
// #endif // #endif
}, },
emits: ['sort-change', 'filter-change'], emits:['sort-change','filter-change'],
props: { props: {
width: { width: {
type: [String, Number], type: [String, Number],
default: '' default: ''
}, },
align: { align: {
type: String, type: String,
default: 'left' default: 'left'
}, },
rowspan: { rowspan: {
type: [Number, String], type: [Number, String],
default: 1 default: 1
}, },
colspan: { colspan: {
type: [Number, String], type: [Number, String],
default: 1 default: 1
}, },
sortable: { sortable: {
type: Boolean, type: Boolean,
default: false default: false
}, },
filterType: { filterType: {
type: String, type: String,
default: '' default: ""
}, },
filterData: { filterData: {
type: Array, type: Array,
default() { default () {
return []; return []
} }
} },
}, filterDefaultValue: {
data() { type: [Array,String],
return { default () {
border: false, return ""
ascending: false, }
descending: false }
}; },
}, data() {
computed: { return {
// 根据props中的width属性 自动匹配当前th的宽度(px) border: false,
customWidth() { ascending: false,
if (typeof this.width === 'number') { descending: false
return this.width; }
} else if (typeof this.width === 'string') { },
let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g); computed: {
let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g); // 根据props中的width属性 自动匹配当前th的宽度(px)
let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g); customWidth(){
if (this.width.match(regexHaveUnitPx) !== null) { if(typeof this.width === 'number'){
// 携带了 px return this.width
return this.width.replace('px', ''); } else if(typeof this.width === 'string') {
} else if (this.width.match(regexHaveUnitRpx) !== null) { let regexHaveUnitPx = new RegExp(/^[1-9][0-9]*px$/g)
// 携带了 rpx let regexHaveUnitRpx = new RegExp(/^[1-9][0-9]*rpx$/g)
let numberRpx = Number(this.width.replace('rpx', '')); let regexHaveNotUnit = new RegExp(/^[1-9][0-9]*$/g)
let widthCoe = uni.getSystemInfoSync().screenWidth / 750; if (this.width.match(regexHaveUnitPx) !== null) { // 携带了 px
return Math.round(numberRpx * widthCoe); return this.width.replace('px', '')
} else if (this.width.match(regexHaveNotUnit) !== null) { } else if (this.width.match(regexHaveUnitRpx) !== null) { // 携带了 rpx
// 未携带 rpx或px 的纯数字 String let numberRpx = Number(this.width.replace('rpx', ''))
return this.width; let widthCoe = uni.getSystemInfoSync().screenWidth / 750
} else { return Math.round(numberRpx * widthCoe)
// 不符合格式 } else if (this.width.match(regexHaveNotUnit) !== null) { // 未携带 rpx或px 的纯数字 String
return ''; return this.width
} } else { // 不符合格式
} else { return ''
return ''; }
} } else {
}, return ''
contentAlign() { }
let align = 'left'; },
switch (this.align) { contentAlign() {
case 'left': let align = 'left'
align = 'flex-start'; switch (this.align) {
break; case 'left':
case 'center': align = 'flex-start'
align = 'center'; break
break; case 'center':
case 'right': align = 'center'
align = 'flex-end'; break
break; case 'right':
} align = 'flex-end'
return align; break
} }
}, return align
created() { }
this.root = this.getTable('uniTable'); },
this.rootTr = this.getTable('uniTr'); created() {
this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140); this.root = this.getTable('uniTable')
this.border = this.root.border; this.rootTr = this.getTable('uniTr')
this.root.thChildren.push(this); this.rootTr.minWidthUpdate(this.customWidth ? this.customWidth : 140)
}, this.border = this.root.border
methods: { this.root.thChildren.push(this)
sort() { },
if (!this.sortable) return; methods: {
this.clearOther(); sort() {
if (!this.ascending && !this.descending) { if (!this.sortable) return
this.ascending = true; this.clearOther()
this.$emit('sort-change', { order: 'ascending' }); if (!this.ascending && !this.descending) {
return; this.ascending = true
} this.$emit('sort-change', { order: 'ascending' })
if (this.ascending && !this.descending) { return
this.ascending = false; }
this.descending = true; if (this.ascending && !this.descending) {
this.$emit('sort-change', { order: 'descending' }); this.ascending = false
return; this.descending = true
} this.$emit('sort-change', { order: 'descending' })
return
}
if (!this.ascending && this.descending) { if (!this.ascending && this.descending) {
this.ascending = false; this.ascending = false
this.descending = false; this.descending = false
this.$emit('sort-change', { order: null }); this.$emit('sort-change', { order: null })
} }
}, },
ascendingFn() { ascendingFn() {
this.clearOther(); this.clearOther()
this.ascending = !this.ascending; this.ascending = !this.ascending
this.descending = false; this.descending = false
this.$emit('sort-change', { order: this.ascending ? 'ascending' : null }); this.$emit('sort-change', { order: this.ascending ? 'ascending' : null })
}, },
descendingFn() { descendingFn() {
this.clearOther(); this.clearOther()
this.descending = !this.descending; this.descending = !this.descending
this.ascending = false; this.ascending = false
this.$emit('sort-change', { order: this.descending ? 'descending' : null }); this.$emit('sort-change', { order: this.descending ? 'descending' : null })
}, },
clearOther() { clearOther() {
this.root.thChildren.map(item => { this.root.thChildren.map(item => {
if (item !== this) { if (item !== this) {
item.ascending = false; item.ascending = false
item.descending = false; item.descending = false
} }
return item; return item
}); })
}, },
ondropdown(e) { ondropdown(e) {
this.$emit('filter-change', e); this.$emit("filter-change", e)
}, },
/** /**
* 获取父元素实例 * 获取父元素实例
*/ */
getTable(name) { getTable(name) {
let parent = this.$parent; let parent = this.$parent
let parentName = parent.$options.name; let parentName = parent.$options.name
while (parentName !== name) { while (parentName !== name) {
parent = parent.$parent; parent = parent.$parent
if (!parent) return false; if (!parent) return false
parentName = parent.$options.name; parentName = parent.$options.name
} }
return parent; return parent
} }
} }
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
$border-color: #ebeef5; $border-color: #ebeef5;
$uni-primary: #007aff !default;
.uni-table-th { .uni-table-th {
padding: 12px 10px; padding: 12px 10px;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: table-cell; display: table-cell;
box-sizing: border-box; box-sizing: border-box;
/* #endif */ /* #endif */
font-size: 12px; font-size: 14px;
font-weight: bold; font-weight: bold;
color: #909399; color: #909399;
border-bottom: 1px $border-color solid; border-bottom: 1px $border-color solid;
} }
.uni-table-th-row { .uni-table-th-row {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */ /* #endif */
flex-direction: row; flex-direction: row;
} }
.table--border { .table--border {
border-right: 1px $border-color solid; border-right: 1px $border-color solid;
} }
.uni-table-th-content { .uni-table-th-content {
display: flex; display: flex;
align-items: center; align-items: center;
flex: 1; flex: 1;
} }
.arrow-box { .arrow-box {
} }
.arrow { .arrow {
display: block; display: block;
position: relative; position: relative;
width: 10px; width: 10px;
height: 8px; height: 8px;
// border: 1px red solid; // border: 1px red solid;
left: 5px; left: 5px;
overflow: hidden; overflow: hidden;
cursor: pointer; cursor: pointer;
} }
.down { .down {
top: 3px; top: 3px;
::after { ::after {
content: ''; content: '';
width: 8px; width: 8px;
height: 8px; height: 8px;
position: absolute; position: absolute;
left: 2px; left: 2px;
top: -5px; top: -5px;
transform: rotate(45deg); transform: rotate(45deg);
background-color: #ccc; background-color: #ccc;
} }
&.active { &.active {
::after { ::after {
background-color: #007aff; background-color: $uni-primary;
} }
} }
} }
.up { .up {
::after { ::after {
content: ''; content: '';
width: 8px; width: 8px;
height: 8px; height: 8px;
position: absolute; position: absolute;
left: 2px; left: 2px;
top: 5px; top: 5px;
transform: rotate(45deg); transform: rotate(45deg);
background-color: #ccc; background-color: #ccc;
} }
&.active { &.active {
::after { ::after {
background-color: #007aff; background-color: $uni-primary;
} }
} }
} }
</style> </style>
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
</script> </script>
<style lang="scss"> <style lang="scss">
$checked-color: #007aff; $uni-primary: #007aff !default;
$border-color: #DCDFE6; $border-color: #DCDFE6;
$disable:0.4; $disable:0.4;
...@@ -125,8 +125,8 @@ ...@@ -125,8 +125,8 @@
} }
&.checkbox--indeterminate { &.checkbox--indeterminate {
border-color: $checked-color; border-color: $uni-primary;
background-color: $checked-color; background-color: $uni-primary;
.checkbox__inner-icon { .checkbox__inner-icon {
position: absolute; position: absolute;
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
} }
} }
&:hover{ &:hover{
border-color: $checked-color; border-color: $uni-primary;
} }
// 禁用 // 禁用
&.is-disable { &.is-disable {
...@@ -160,8 +160,8 @@ ...@@ -160,8 +160,8 @@
// 选中 // 选中
&.is-checked { &.is-checked {
border-color: $checked-color; border-color: $uni-primary;
background-color: $checked-color; background-color: $uni-primary;
.checkbox__inner-icon { .checkbox__inner-icon {
opacity: 1; opacity: 1;
......
<template> <template>
<!-- #ifdef H5 --> <!-- #ifdef H5 -->
<tr class="uni-table-tr"> <tr class="uni-table-tr">
<th v-if="selection === 'selection' && ishead" class="checkbox" :class="{ 'tr-table--border': border }"><table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox></th> <th v-if="selection === 'selection' && ishead" class="checkbox" :class="{ 'tr-table--border': border }">
<slot></slot> <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
<!-- <uni-th class="th-fixed">123</uni-th> --> </th>
</tr> <slot></slot>
<!-- #endif --> <!-- <uni-th class="th-fixed">123</uni-th> -->
<!-- #ifndef H5 --> </tr>
<view class="uni-table-tr" :class="{ disabledClass: disabledClass }"> <!-- #endif -->
<view v-if="selection === 'selection'" class="checkbox" :class="{ 'tr-table--border': border }"><table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox></view> <!-- #ifndef H5 -->
<slot></slot> <view class="uni-table-tr">
</view> <view v-if="selection === 'selection' " class="checkbox" :class="{ 'tr-table--border': border }">
<!-- #endif --> <table-checkbox :checked="checked" :indeterminate="indeterminate" :disabled="disabled" @checkboxSelected="checkboxSelected"></table-checkbox>
</view>
<slot></slot>
</view>
<!-- #endif -->
</template> </template>
<script> <script>
import tableCheckbox from './table-checkbox.vue'; import tableCheckbox from './table-checkbox.vue'
/** /**
* Tr 表格行组件 * Tr 表格行组件
* @description 表格行组件 仅包含 th,td 组件 * @description 表格行组件 仅包含 th,td 组件
* @tutorial https://ext.dcloud.net.cn/plugin?id= * @tutorial https://ext.dcloud.net.cn/plugin?id=
*/ */
export default { export default {
name: 'uniTr', name: 'uniTr',
components: { tableCheckbox }, components: { tableCheckbox },
props: { props: {
disabledClass: { disabled: {
type: Boolean, type: Boolean,
default: false default: false
}, },
disabled: { keyValue: {
type: Boolean, type: [String, Number],
default: false default: ''
}, }
keyValue: { },
type: [String, Number], options: {
default: '' virtualHost: true
} },
}, data() {
options: { return {
virtualHost: true value: false,
}, border: false,
data() { selection: false,
return { widthThArr: [],
value: false, ishead: true,
border: false, checked: false,
selection: false, indeterminate:false
widthThArr: [], }
ishead: true, },
checked: false, created() {
indeterminate: false this.root = this.getTable()
}; this.head = this.getTable('uniThead')
}, if (this.head) {
created() { this.ishead = false
this.root = this.getTable(); this.head.init(this)
this.head = this.getTable('uniThead'); }
if (this.head) { this.border = this.root.border
this.ishead = false; this.selection = this.root.type
this.head.init(this); this.root.trChildren.push(this)
} const rowData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
this.border = this.root.border; if(rowData){
this.selection = this.root.type; this.rowData = rowData
this.root.trChildren.push(this); }
const rowData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue); this.root.isNodata()
if (rowData) { },
this.rowData = rowData; mounted() {
} if (this.widthThArr.length > 0) {
this.root.isNodata(); const selectionWidth = this.selection === 'selection' ? 50 : 0
}, this.root.minWidth = Number(this.widthThArr.reduce((a, b) => Number(a) + Number(b))) + selectionWidth;
mounted() { }
if (this.widthThArr.length > 0) { },
const selectionWidth = this.selection === 'selection' ? 50 : 0; // #ifndef VUE3
this.root.minWidth = this.widthThArr.reduce((a, b) => Number(a) + Number(b)) + selectionWidth; destroyed() {
} const index = this.root.trChildren.findIndex(i => i === this)
}, this.root.trChildren.splice(index, 1)
// #ifndef VUE3 this.root.isNodata()
destroyed() { },
const index = this.root.trChildren.findIndex(i => i === this); // #endif
this.root.trChildren.splice(index, 1); // #ifdef VUE3
this.root.isNodata(); unmounted() {
}, const index = this.root.trChildren.findIndex(i => i === this)
// #endif this.root.trChildren.splice(index, 1)
// #ifdef VUE3 this.root.isNodata()
unmounted() { },
const index = this.root.trChildren.findIndex(i => i === this); // #endif
this.root.trChildren.splice(index, 1); methods: {
this.root.isNodata(); minWidthUpdate(width) {
}, this.widthThArr.push(width)
// #endif if (this.widthThArr.length > 0) {
methods: { const selectionWidth = this.selection === 'selection' ? 50 : 0;
minWidthUpdate(width) { this.root.minWidth = Number(this.widthThArr.reduce((a, b) => Number(a) + Number(b))) + selectionWidth;
this.widthThArr.push(width); }
}, },
// 选中 // 选中
checkboxSelected(e) { checkboxSelected(e) {
let rootData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue); let rootData = this.root.data.find(v => v[this.root.rowKey] === this.keyValue)
this.checked = e.checked; this.checked = e.checked
this.root.check(rootData || this, e.checked, rootData ? this.keyValue : null); this.root.check(rootData||this, e.checked,rootData? this.keyValue:null)
}, },
change(e) { change(e) {
this.root.trChildren.forEach(item => { this.root.trChildren.forEach(item => {
if (item === this) { if (item === this) {
this.root.check(this, e.detail.value.length > 0 ? true : false); this.root.check(this, e.detail.value.length > 0 ? true : false)
} }
}); })
}, },
/** /**
* 获取父元素实例 * 获取父元素实例
*/ */
getTable(name = 'uniTable') { getTable(name = 'uniTable') {
let parent = this.$parent; let parent = this.$parent
let parentName = parent.$options.name; let parentName = parent.$options.name
while (parentName !== name) { while (parentName !== name) {
parent = parent.$parent; parent = parent.$parent
if (!parent) return false; if (!parent) return false
parentName = parent.$options.name; parentName = parent.$options.name
} }
return parent; return parent
} }
} }
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
$border-color: #ebeef5; $border-color: #ebeef5;
.uni-table-tr { .uni-table-tr {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: table-row; display: table-row;
transition: all 0.3s; transition: all 0.3s;
box-sizing: border-box; box-sizing: border-box;
/* #endif */ /* #endif */
} }
.checkbox { .checkbox {
padding: 0 8px; padding: 0 8px;
width: 26px; width: 26px;
padding-left: 12px; padding-left: 12px;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
/* #endif */ /* #endif */
color: #333; color: #333;
font-weight: 500; font-weight: 500;
border-bottom: 1px $border-color solid; border-bottom: 1px $border-color solid;
font-size: 14px; font-size: 14px;
// text-align: center; // text-align: center;
} }
.tr-table--border { .tr-table--border {
border-right: 1px $border-color solid; border-right: 1px $border-color solid;
} }
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.uni-table-tr { .uni-table-tr {
::v-deep .uni-table-th { ::v-deep .uni-table-th {
&.table--border:last-child { &.table--border:last-child {
// border-right: none; // border-right: none;
} }
} }
::v-deep .uni-table-td { ::v-deep .uni-table-td {
&.table--border:last-child { &.table--border:last-child {
// border-right: none; // border-right: none;
} }
} }
} }
/* #endif */ /* #endif */
......
{ {
"id": "uni-table", "id": "uni-table",
"displayName": "uni-table 表格", "displayName": "uni-table 表格",
"version": "1.2.1", "version": "1.2.4",
"description": "表格组件,多用于展示多条结构类似的数据,如", "description": "表格组件,多用于展示多条结构类似的数据,如",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
...@@ -16,11 +16,7 @@ ...@@ -16,11 +16,7 @@
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
...@@ -37,7 +33,8 @@ ...@@ -37,7 +33,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-scss","uni-datetime-picker"], "dependencies": ["uni-scss","uni-datetime-picker"],
......
...@@ -349,8 +349,35 @@ const API = { ...@@ -349,8 +349,35 @@ const API = {
/** /**
* 理货记录 * 理货记录
*/ */
getTallyRecordList: API_BASE + '/supplywechatwms/getTallyRecordList' getTallyRecordList: API_BASE + '/supplywechatwms/getTallyRecordList',
/**
* 异常管理列表
*/
abnormalManageList: API_BASE + '/supplywechatwms/abnormalManageList',
/**
* 异常作废
*/
cancelAbnormal: API_BASE + '/supplywechatwms/cancelAbnormal',
/**
* 异常确认
*/
confirmAbnormal: API_BASE + '/supplywechatwms/confirmAbnormal',
/**
* 入仓号进行模糊查询
*/
getAllOrderDataByEntrustNo: API_BASE + '/supplywechatwms/getAllOrderDataByEntrustNo',
/**
* 根据订单ID获取明细
*/
getOrderDetailById: API_BASE + '/supplywechatwms/getOrderDetailById',
/**
* 新增异常
*/
addAbnormal: API_BASE + '/supplywechatwms/addAbnormal',
/**
* 获取快捷用语
*/
getQuickExpressions: API_BASE + '/supplywechatwms/getQuickExpressions'
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment