Commit 1dd19fc2 by LJM

js

parent 0983f604
......@@ -54,7 +54,8 @@
text {
font-size: 26rpx;
color: #197adb;
margin-right: 10rpx;
margin-right: 60rpx;
font-weight: bold;
&:last-child {
margin-right: 0;
}
......@@ -63,6 +64,7 @@
}
}
.uni-table-box {
padding-top: 24rpx;
padding-bottom: 24rpx;
background-color: #ffffff;
::v-deep .uni-table-scroll {
......@@ -81,7 +83,7 @@
height: 98rpx;
background: #ffffff;
padding: 0 24rpx;
z-index: 999;
z-index: 98;
.t1 {
font-size: 22rpx;
color: #404547;
......@@ -116,6 +118,7 @@
border-radius: 4rpx;
font-size: 28rpx;
color: #ffffff;
margin-bottom: 100rpx;
}
}
......@@ -160,4 +163,10 @@
.uni-table-td {
border-right: 1px #ebeef5 solid;
}
.pop-list .uni-table-th {
width: 33.3% !important;
}
.pop-list .uni-table-td {
width: 33.3% !important;
}
}
<template>
<view class="scanInventory">
<view class="scanInven-form-item">
<view class="box row verCenter operate"><text>箱列表</text></view>
<view class="box row verCenter operate">
<text @click="exportChange()">导出</text>
<text @click="getBoxSnAndNumAll()">箱列表</text>
</view>
<view class="box row verCenter">
<view class="label">箱号</view>
<input v-model="box_sn" @input="inputChange" placeholder-style="font-size:24rpx;" class="uni-input" placeholder="请输入箱号" />
......@@ -17,7 +20,7 @@
</view>
</view>
</view>
<view class="addRow row rowCenter verCenter">新增行</view>
<view class="addRow row rowCenter verCenter" @click="addRowChange()">新增行</view>
<view class="uni-table-box">
<uni-table type="selection" border stripe emptyText="暂无更多数据" @selection-change="selectionChange">
<uni-tr>
......@@ -28,8 +31,8 @@
</uni-tr>
<uni-tr v-for="(item, index) in list" :key="index">
<uni-td align="center">{{ index + 1 }}</uni-td>
<uni-td align="center"><input class="uni-input" :value="item.goods_sn" /></uni-td>
<uni-td align="center"><input class="uni-input" :value="item.goods_num" /></uni-td>
<uni-td align="center"><input class="uni-input" v-model="list[index].goods_sn" /></uni-td>
<uni-td align="center"><input class="uni-input" v-model="list[index].goods_num" /></uni-td>
<uni-td align="center">{{ item.scan_time_cn }}</uni-td>
</uni-tr>
</uni-table>
......@@ -42,6 +45,22 @@
</view>
<view class="btn row rowCenter verCenter" @click="deleteChange">删除</view>
</view>
<uni-popup ref="popup" type="center" background-color="#fff">
<view class="uni-table-box pop-list" style="width: 550rpx;">
<uni-table border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th align="center">箱号</uni-th>
<uni-th align="center">货品数</uni-th>
<uni-th align="center">保存时间</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in listPop" :key="index">
<uni-td align="center">{{ item.box_sn }}</uni-td>
<uni-td align="center">{{ item.box_sn_goods_num }}</uni-td>
<uni-td align="center">{{ item.scan_time_cn }}</uni-td>
</uni-tr>
</uni-table>
</view>
</uni-popup>
</view>
</template>
......@@ -55,14 +74,28 @@ export default {
code_str: 'QTY:500 PN:PR03-1R CPN:PR03000201008JAC00 PO:18365781/11 CPO:B131190+A64120 MFR:VISHAY MPN:PR03000201008JAC00 RoHS',
code_type: '',
list: [],
listPop: [],
selectedIndexs: [],
index: -1,
array: ['扫描digikey', '扫描Mouser', '扫描Arrow', '扫描Rochester', '扫描TME', '扫描Chip1stop'],
arrar_val: ['digikey', 'Mouser', 'Arrow', 'Rochester', 'TME', 'Chip1stop']
};
},
created() {},
methods: {
getBoxSnAndNumAll() {
this.request(API.getBoxSnAndNum, 'POST', { box_sn: '' }, true).then(res => {
if (res.err_code === 0) {
this.listPop = res.data;
this.$refs.popup.open('center');
} else {
uni.showModal({
title: '提示',
content: res.err_msg,
showCancel: false
});
}
});
},
getBoxSnAndNum() {
this.request(API.getBoxSnAndNum, 'POST', { box_sn: this.box_sn }, false).then(res => {
if (res.err_code === 0) {
......@@ -82,7 +115,7 @@ export default {
this.list.unshift({
goods_num: res.data.num || '',
goods_sn: res.data.sn || '',
scan_time: '',
scan_time_cn: '',
wsbxnmsn_id: ''
});
} else {
......@@ -128,6 +161,47 @@ export default {
this.list.splice(this.selectedIndexs[i], 1);
}
},
exportChange() {
this.request(API.getBoxSnAndNum, 'POST', { box_sn: this.box_sn, export: 1 }, true).then(res => {
if (res.err_code === 0) {
uni.downloadFile({
url: res.data,
success: function(res) {
const filePath = res.tempFilePath;
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
console.log('打开文档成功');
},
fail: function() {
uni.showModal({
title: '提示',
content: '暂不支持该文件类型预览',
showCancel: false
});
console.log('打开文档失败');
}
});
}
});
} else {
uni.showModal({
title: '提示',
content: res.err_msg,
showCancel: false
});
}
});
},
addRowChange() {
this.list.unshift({
goods_num: '',
goods_sn: '',
scan_time_cn: '',
wsbxnmsn_id: ''
});
},
submit() {
let params = {};
let arr = [];
......@@ -140,7 +214,7 @@ export default {
}
params.list = JSON.stringify(arr);
params.box_sn = this.box_sn;
this.request(API.submitBoxSnAndNum, 'POST', params, false).then(res => {
this.request(API.submitBoxSnAndNum, 'POST', params, true).then(res => {
if (res.err_code === 0) {
uni.showModal({
title: '提示',
......
## 1.8.2(2023-02-02)
- uni-popup-dialog 组件新增 inputType 属性
## 1.8.1(2022-12-01)
- 修复 nvue 下 v-show 报错
## 1.8.0(2022-11-29)
- 优化 主题样式
## 1.7.9(2022-04-02)
- 修复 弹出层内部无法滚动的bug
## 1.7.8(2022-03-28)
- 修复 小程序中高度错误的bug
## 1.7.7(2022-03-17)
- 修复 快速调用open出现问题的Bug
## 1.7.6(2022-02-14)
- 修复 safeArea 属性不能设置为false的bug
## 1.7.5(2022-01-19)
- 修复 isMaskClick 失效的bug
## 1.7.4(2022-01-19)
- 新增 cancelText \ confirmText 属性 ,可自定义文本
- 新增 maskBackgroundColor 属性 ,可以修改蒙版颜色
- 优化 maskClick属性 更新为 isMaskClick ,解决微信小程序警告的问题
## 1.7.3(2022-01-13)
- 修复 设置 safeArea 属性不生效的bug
## 1.7.2(2021-11-26)
- 优化 组件示例
## 1.7.1(2021-11-26)
- 修复 vuedoc 文字错误
## 1.7.0(2021-11-19)
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-popup](https://uniapp.dcloud.io/component/uniui/uni-popup)
## 1.6.2(2021-08-24)
- 新增 支持国际化
## 1.6.1(2021-07-30)
......
......@@ -10,12 +10,12 @@
</view>
<view v-else class="uni-dialog-content">
<slot>
<input class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholderText" :focus="focus" >
<input class="uni-dialog-input" v-model="val" :type="inputType" :placeholder="placeholderText" :focus="focus" >
</slot>
</view>
<view class="uni-dialog-button-group">
<view class="uni-dialog-button" @click="closeDialog">
<text class="uni-dialog-button-text">{{cancelText}}</text>
<text class="uni-dialog-button-text">{{closeText}}</text>
</view>
<view class="uni-dialog-button uni-border-left" @click="onOk">
<text class="uni-dialog-button-text uni-button-color">{{okText}}</text>
......@@ -57,6 +57,10 @@
mixins: [popup],
emits:['confirm','close'],
props: {
inputType:{
type: String,
default: 'text'
},
value: {
type: [String, Number],
default: ''
......@@ -84,6 +88,14 @@
beforeClose: {
type: Boolean,
default: false
},
cancelText:{
type: String,
default: ''
},
confirmText:{
type: String,
default: ''
}
},
data() {
......@@ -95,10 +107,10 @@
},
computed: {
okText() {
return t("uni-popup.ok")
return this.confirmText || t("uni-popup.ok")
},
cancelText() {
return t("uni-popup.cancel")
closeText() {
return this.cancelText || t("uni-popup.cancel")
},
placeholderText() {
return this.placeholder || t("uni-popup.placeholder")
......@@ -162,10 +174,10 @@
}
</script>
<style lang="scss" scoped>
<style lang="scss" >
.uni-popup-dialog {
width: 300px;
border-radius: 15px;
border-radius: 11px;
background-color: #fff;
}
......@@ -175,8 +187,7 @@
/* #endif */
flex-direction: row;
justify-content: center;
padding-top: 15px;
padding-bottom: 5px;
padding-top: 25px;
}
.uni-dialog-title-text {
......@@ -191,12 +202,12 @@
flex-direction: row;
justify-content: center;
align-items: center;
padding: 5px 15px 15px 15px;
padding: 20px;
}
.uni-dialog-content-text {
font-size: 14px;
color: #6e6e6e;
color: #6C6C6C;
}
.uni-dialog-button-group {
......@@ -228,7 +239,8 @@
}
.uni-dialog-button-text {
font-size: 14px;
font-size: 16px;
color: #333;
}
.uni-button-color {
......
......@@ -71,7 +71,7 @@
}
}
</script>
<style lang="scss" scoped>
<style lang="scss" >
.uni-popup-message {
/* #ifndef APP-NVUE */
display: flex;
......
......@@ -59,16 +59,16 @@
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/0dacdbe0-50bf-11eb-8ff1-d5dcf8779628.png',
name: 'sina'
},
{
text: '百度',
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
name: 'copy'
},
{
text: '其他',
icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png',
name: 'more'
}
// {
// text: '百度',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/1ec6e920-50bf-11eb-8a36-ebb87efcf8c0.png',
// name: 'copy'
// },
// {
// text: '其他',
// icon: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/2e0fdfe0-50bf-11eb-b997-9918a5dda011.png',
// name: 'more'
// }
]
}
},
......@@ -103,9 +103,11 @@
}
}
</script>
<style lang="scss" scoped>
<style lang="scss" >
.uni-popup-share {
background-color: #fff;
border-top-left-radius: 11px;
border-top-right-radius: 11px;
}
.uni-share-title {
/* #ifndef APP-NVUE */
......
<template>
<view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']" @touchmove.stop.prevent="clear">
<view @touchstart="touchstart" >
<uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
<uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
<view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear"><slot /></view>
<view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']">
<view @touchstart="touchstart">
<uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass"
:duration="duration" :show="showTrans" @click="onTap" />
<uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration"
:show="showTrans" @click="onTap">
<view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear">
<slot />
</view>
</uni-transition>
</view>
<!-- #ifdef H5 -->
......@@ -13,11 +17,11 @@
</template>
<script>
// #ifdef H5
import keypress from './keypress.js'
// #endif
// #ifdef H5
import keypress from './keypress.js'
// #endif
/**
/**
* PopUp 弹出层
* @description 弹出层组件,为了解决遮罩弹层的问题
* @tutorial https://ext.dcloud.net.cn/plugin?id=329
......@@ -30,22 +34,24 @@ import keypress from './keypress.js'
* @value message 消息提示
* @value dialog 对话框
* @value share 底部分享示例
* @property {Boolean} animation = [ture|false] 是否开启动画
* @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
* @property {Boolean} animation = [true|false] 是否开启动画
* @property {Boolean} maskClick = [true|false] 蒙版点击是否关闭弹窗(废弃)
* @property {Boolean} isMaskClick = [true|false] 蒙版点击是否关闭弹窗
* @property {String} backgroundColor 主窗口背景色
* @property {String} maskBackgroundColor 蒙版颜色
* @property {Boolean} safeArea 是否适配底部安全区
* @event {Function} change 打开关闭弹窗触发,e={show: false}
* @event {Function} maskClick 点击遮罩触发
*/
export default {
export default {
name: 'uniPopup',
components: {
// #ifdef H5
keypress
// #endif
},
emits:['change','maskClick'],
emits: ['change', 'maskClick'],
props: {
// 开启动画
animation: {
......@@ -59,18 +65,27 @@ export default {
default: 'center'
},
// maskClick
isMaskClick: {
type: Boolean,
default: null
},
// TODO 2 个版本后废弃属性 ,使用 isMaskClick
maskClick: {
type: Boolean,
default: true
default: null
},
backgroundColor: {
type: String,
default: 'none'
},
safeArea:{
safeArea: {
type: Boolean,
default: true
}
},
maskBackgroundColor: {
type: String,
default: 'rgba(0, 0, 0, 0.4)'
},
},
watch: {
......@@ -100,6 +115,19 @@ export default {
this.mkclick = val
},
immediate: true
},
isMaskClick: {
handler: function(val) {
this.mkclick = val
},
immediate: true
},
// H5 下禁止底部滚动
showPopup(show) {
// #ifdef H5
// fix by mehaotian 处理 h5 滚动穿透的问题
document.getElementsByTagName('body')[0].style.overflow = show ? 'hidden' : 'visible'
// #endif
}
},
data() {
......@@ -151,13 +179,25 @@ export default {
},
mounted() {
const fixSize = () => {
const { windowWidth, windowHeight, windowTop, safeAreaInsets } = uni.getSystemInfoSync()
const {
windowWidth,
windowHeight,
windowTop,
safeArea,
screenHeight,
safeAreaInsets
} = uni.getSystemInfoSync()
this.popupWidth = windowWidth
this.popupHeight = windowHeight + windowTop
// 是否适配底部安全区
if(this.safeArea){
this.safeAreaInsets = safeAreaInsets
}else{
this.popupHeight = windowHeight + (windowTop || 0)
// TODO fix by mehaotian 是否适配底部安全区 ,目前微信ios 、和 app ios 计算有差异,需要框架修复
if (safeArea && this.safeArea) {
// #ifdef MP-WEIXIN
this.safeAreaInsets = screenHeight - safeArea.bottom
// #endif
// #ifndef MP-WEIXIN
this.safeAreaInsets = safeAreaInsets.bottom
// #endif
} else {
this.safeAreaInsets = 0
}
}
......@@ -169,8 +209,25 @@ export default {
// })
// #endif
},
// #ifndef VUE3
// TODO vue2
destroyed() {
this.setH5Visible()
},
// #endif
// #ifdef VUE3
// TODO vue3
unmounted() {
this.setH5Visible()
},
// #endif
created() {
this.mkclick = this.maskClick
// this.mkclick = this.isMaskClick || this.maskClick
if (this.isMaskClick === null && this.maskClick === null) {
this.mkclick = true
} else {
this.mkclick = this.isMaskClick !== null ? this.isMaskClick : this.maskClick
}
if (this.animation) {
this.duration = 300
} else {
......@@ -180,8 +237,15 @@ export default {
this.messageChild = null
// TODO 解决头条冒泡的问题
this.clearPropagation = false
this.maskClass.backgroundColor = this.maskBackgroundColor
},
methods: {
setH5Visible() {
// #ifdef H5
// fix by mehaotian 处理 h5 滚动穿透的问题
document.getElementsByTagName('body')[0].style.overflow = 'visible'
// #endif
},
/**
* 公用方法,不显示遮罩层
*/
......@@ -203,6 +267,11 @@ export default {
},
open(direction) {
// fix by mehaotian 处理快速打开关闭的情况
if (this.showPopup) {
clearTimeout(this.timer)
this.showPopup = false
}
let innerType = ['top', 'center', 'bottom', 'left', 'right', 'message', 'dialog', 'share']
if (!(direction && innerType.indexOf(direction) !== -1)) {
direction = this.type
......@@ -231,7 +300,7 @@ export default {
}, 300)
},
// TODO 处理冒泡事件,头条的冒泡事件有问题 ,先这样兼容
touchstart(){
touchstart() {
this.clearPropagation = false
},
......@@ -273,13 +342,12 @@ export default {
bottom(type) {
this.popupstyle = 'bottom'
this.ani = ['slide-bottom']
this.transClass = {
position: 'fixed',
left: 0,
right: 0,
bottom: 0,
paddingBottom: (this.safeAreaInsets && this.safeAreaInsets.bottom) || 0,
paddingBottom: this.safeAreaInsets + 'px',
backgroundColor: this.bg
}
// TODO 兼容 type 属性 ,后续会废弃
......@@ -350,13 +418,14 @@ export default {
this.showTrans = true
}
}
}
}
</script>
<style lang="scss" scoped>
.uni-popup {
<style lang="scss">
.uni-popup {
position: fixed;
/* #ifndef APP-NVUE */
z-index: 99;
/* #endif */
&.top,
&.left,
......@@ -368,11 +437,13 @@ export default {
top: 0;
/* #endif */
}
.uni-popup__wrapper {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
position: relative;
/* iphonex 等安全区设置,底部安全区适配 */
/* #ifndef APP-NVUE */
// padding-bottom: constant(safe-area-inset-bottom);
......@@ -389,15 +460,15 @@ export default {
flex: 1;
}
}
}
}
.fixforpc-z-index {
.fixforpc-z-index {
/* #ifndef APP-NVUE */
z-index: 999;
/* #endif */
}
}
.fixforpc-top {
.fixforpc-top {
top: 0;
}
}
</style>
{
"id": "uni-popup",
"displayName": "uni-popup 弹出层",
"version": "1.6.2",
"version": "1.8.2",
"description": " Popup 组件,提供常用的弹层",
"keywords": [
"uni-ui",
......@@ -18,10 +18,6 @@
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
......@@ -38,10 +34,12 @@
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": [
"uni-scss",
"uni-transition"
],
"encrypt": [],
......@@ -81,7 +79,7 @@
},
"Vue": {
"vue2": "y",
"vue3": "u"
"vue3": "y"
}
}
}
......
## 1.3.1(2021-11-23)
- 修复 init 方法初始化问题
## 1.3.0(2021-11-19)
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-transition](https://uniapp.dcloud.io/component/uniui/uni-transition)
## 1.2.1(2021-09-27)
- 修复 init 方法不生效的 Bug
## 1.2.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.1(2021-05-12)
- 新增 示例地址
- 修复 示例项目缺少组件的Bug
- 修复 示例项目缺少组件的 Bug
## 1.1.0(2021-04-22)
- 新增 通过方法自定义动画
- 新增 custom-class 非 NVUE 平台支持自定义 class 定制样式
......@@ -10,4 +17,4 @@
- 优化 支持单独的动画类型
- 优化 文档示例
## 1.0.2(2021-02-05)
- 调整为uni_modules目录规范
- 调整为 uni_modules 目录规范
......@@ -112,7 +112,7 @@ export default {
if (obj.duration) {
this.durationTime = obj.duration
}
this.animation = createAnimation(Object.assign(this.config, obj))
this.animation = createAnimation(Object.assign(this.config, obj),this)
},
/**
* 点击组件触发回调
......
{
"id": "uni-transition",
"displayName": "uni-transition 过渡动画",
"version": "1.2.0",
"version": "1.3.1",
"description": "元素的简单过渡动画",
"keywords": [
"uni-ui",
......@@ -41,7 +41,7 @@
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": [],
"dependencies": ["uni-scss"],
"encrypt": [],
"platforms": {
"cloud": {
......@@ -76,6 +76,10 @@
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
......
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