批量退料-二维码添加
This commit is contained in:
parent
2ce3ad0ab3
commit
1a503277e2
|
|
@ -1,277 +1,309 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="ep-picker-box">
|
<view class="ep-picker-box">
|
||||||
<!-- 蒙版区域 开始 -->
|
<!-- 蒙版区域 开始 -->
|
||||||
<view class="ep-mask-box" v-show="show" @click="show=false"></view>
|
<view class="ep-mask-box" v-show="show" @click="show = false"></view>
|
||||||
<!-- 蒙版区域 开始 -->
|
<!-- 蒙版区域 开始 -->
|
||||||
|
|
||||||
<!-- 输入框区域 开始 -->
|
<!-- 输入框区域 开始 -->
|
||||||
<view class="ep-input-box" @click="openOptions">
|
<view class="ep-input-box" @click="openOptions">
|
||||||
<!-- <view style="display: flex;align-items: center;min-height: 36px;font-size: 28rpx;">{{showLabel}}</view> -->
|
<!-- <view style="display: flex;align-items: center;min-height: 36px;font-size: 28rpx;">{{showLabel}}</view> -->
|
||||||
<uni-easyinput v-model="showLabel" maxlength="20" :placeholder="placeholder"
|
<uni-easyinput
|
||||||
style="width: 100%;font-size: 28rpx;" @input="inputChange" @clear="handleClear" :disabled="disabled"/>
|
v-model="showLabel"
|
||||||
<!-- <image src="@/static/img/select.png" mode="" style="width: 36rpx;height: 36rpx;"></image> -->
|
maxlength="20"
|
||||||
</view>
|
:placeholder="placeholder"
|
||||||
<!-- 输入框区域 结束 -->
|
style="width: 100%; font-size: 28rpx"
|
||||||
|
@input="inputChange"
|
||||||
<!-- 弹出的下拉区域 开始 -->
|
@clear="handleClear"
|
||||||
<view v-show="show" class="ep-picker-content-wrap">
|
:disabled="disabled"
|
||||||
<scroll-view class="ep-picker-content" :scroll-y="true">
|
/>
|
||||||
<!-- 展示下拉项列表 开始 -->
|
<!-- <image src="@/static/img/select.png" mode="" style="width: 36rpx;height: 36rpx;"></image> -->
|
||||||
<leoTree :data="selectData" @node-click="nodeClick" :defaultProps="defaultProps"></leoTree>
|
</view>
|
||||||
<!-- 展示下拉项列表 结束 -->
|
<!-- 输入框区域 结束 -->
|
||||||
|
|
||||||
<!-- 下拉列表为空 开始 -->
|
<!-- 弹出的下拉区域 开始 -->
|
||||||
<view v-if="selectData.length==0" class="option-no-data">无数据...</view>
|
<view v-show="show" class="ep-picker-content-wrap">
|
||||||
<!-- 下拉列表为空 结束 -->
|
<scroll-view class="ep-picker-content" :scroll-y="true">
|
||||||
</scroll-view>
|
<!-- 展示下拉项列表 开始 -->
|
||||||
<text class="triangle"></text>
|
<leoTree :data="selectData" @node-click="nodeClick" :defaultProps="defaultProps"></leoTree>
|
||||||
</view>
|
<!-- 展示下拉项列表 结束 -->
|
||||||
<!-- 弹出的下拉区域 结束 -->
|
|
||||||
</view>
|
<!-- 下拉列表为空 开始 -->
|
||||||
|
<view v-if="selectData.length == 0" class="option-no-data">无数据...</view>
|
||||||
|
<!-- 下拉列表为空 结束 -->
|
||||||
|
</scroll-view>
|
||||||
|
<text class="triangle"></text>
|
||||||
|
</view>
|
||||||
|
<!-- 弹出的下拉区域 结束 -->
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import leoTree from '@/components/tree-select/tree/tree.vue';
|
import leoTree from '@/components/tree-select/tree/tree.vue'
|
||||||
export default {
|
export default {
|
||||||
name: "eselect",
|
name: 'eselect',
|
||||||
components:{
|
components: {
|
||||||
leoTree
|
leoTree,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
show: false,
|
show: false,
|
||||||
left: 0,
|
left: 0,
|
||||||
showLabel:"",
|
showLabel: '',
|
||||||
placeholder:"请选择",
|
placeholder: '请选择',
|
||||||
selectData:[]
|
selectData: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: ""
|
default: '',
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: function() {
|
default: function () {
|
||||||
return []
|
return []
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
value_key: {
|
value_key: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "value"
|
default: 'value',
|
||||||
},
|
},
|
||||||
label_key: {
|
label_key: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "label"
|
default: 'label',
|
||||||
},
|
},
|
||||||
defaultProps: {
|
defaultProps: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {
|
return {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'name'
|
label: 'name',
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
detailValue: {
|
detailValue: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: ""
|
default: '',
|
||||||
},
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
// 监听 value 的变化 立即监听
|
||||||
setTimeout(() => {
|
watch: {
|
||||||
// console.log('🚀 ~ created ~ this.detailValue:', this.detailValue)
|
value: {
|
||||||
if (this.detailValue) {
|
immediate: true,
|
||||||
this.showLabel = this.detailValue
|
handler(newVal) {
|
||||||
} else {
|
this.updateShowLabel(newVal)
|
||||||
this.showLabel = ''
|
},
|
||||||
}
|
},
|
||||||
}, 200)
|
},
|
||||||
},
|
mounted() {
|
||||||
methods: {
|
setTimeout(() => {
|
||||||
|
// console.log('🚀 ~ created ~ this.detailValue:', this.detailValue)
|
||||||
//展开选项
|
if (this.detailValue) {
|
||||||
openOptions() {
|
this.showLabel = this.detailValue
|
||||||
if (this.disabled) return
|
} else {
|
||||||
if(this.showLabel==""){
|
this.showLabel = ''
|
||||||
this.selectData=this.options
|
}
|
||||||
}else{
|
}, 200)
|
||||||
this.selectData=this.mapTree(this.showLabel,this.options)
|
},
|
||||||
}
|
methods: {
|
||||||
this.show = true;
|
updateShowLabel(val) {
|
||||||
},
|
const target = this.findNodeById(this.options, val)
|
||||||
nodeClick(e){
|
this.showLabel = target ? target[this.defaultProps.label] : ''
|
||||||
if(!e.children){
|
},
|
||||||
this.show = false;
|
findNodeById(list, id) {
|
||||||
this.showLabel=e.name;
|
for (const item of list) {
|
||||||
this.$emit('change', e)
|
if (item[this.defaultProps.id] === id) {
|
||||||
}
|
return item
|
||||||
},
|
}
|
||||||
clearInput(){
|
const children = item[this.defaultProps.children]
|
||||||
this.showLabel="";
|
if (children && children.length) {
|
||||||
this.selectData=this.options;
|
const result = this.findNodeById(children, id)
|
||||||
},
|
if (result) return result
|
||||||
handleClear(){
|
}
|
||||||
this.$emit('clear')
|
}
|
||||||
},
|
return null
|
||||||
//输入框查询
|
},
|
||||||
inputChange(e){
|
|
||||||
// console.log(e)
|
//展开选项
|
||||||
if(e==""){
|
openOptions() {
|
||||||
this.selectData=this.options
|
if (this.disabled) return
|
||||||
}else{
|
if (this.showLabel == '') {
|
||||||
this.selectData=this.mapTree(e,this.options)
|
this.selectData = this.options
|
||||||
}
|
} else {
|
||||||
// console.log(this.selectData)
|
this.selectData = this.mapTree(this.showLabel, this.options)
|
||||||
},
|
}
|
||||||
mapTree(value,arr){
|
this.show = true
|
||||||
let newarr = [];
|
},
|
||||||
arr.forEach(element => {
|
nodeClick(e) {
|
||||||
if (element.name.indexOf(value) > -1) { // 判断条件
|
if (!e.children) {
|
||||||
newarr.push(element);
|
this.show = false
|
||||||
} else {
|
this.showLabel = e.name
|
||||||
if (element.children && element.children.length > 0) {
|
this.$emit('change', e)
|
||||||
let redata = this.mapTree(value, element.children);
|
}
|
||||||
if (redata && redata.length > 0) {
|
},
|
||||||
let obj = {
|
clearInput() {
|
||||||
...element,
|
this.showLabel = ''
|
||||||
children: redata,
|
this.selectData = this.options
|
||||||
expanded: true // 展开子节点
|
},
|
||||||
};
|
handleClear() {
|
||||||
newarr.push(obj);
|
this.$emit('clear')
|
||||||
}
|
},
|
||||||
}
|
//输入框查询
|
||||||
}
|
inputChange(e) {
|
||||||
});
|
// console.log(e)
|
||||||
return newarr;
|
if (e == '') {
|
||||||
}
|
this.selectData = this.options
|
||||||
},
|
} else {
|
||||||
}
|
this.selectData = this.mapTree(e, this.options)
|
||||||
|
}
|
||||||
|
// console.log(this.selectData)
|
||||||
|
},
|
||||||
|
mapTree(value, arr) {
|
||||||
|
let newarr = []
|
||||||
|
arr.forEach((element) => {
|
||||||
|
if (element.name.indexOf(value) > -1) {
|
||||||
|
// 判断条件
|
||||||
|
newarr.push(element)
|
||||||
|
} else {
|
||||||
|
if (element.children && element.children.length > 0) {
|
||||||
|
let redata = this.mapTree(value, element.children)
|
||||||
|
if (redata && redata.length > 0) {
|
||||||
|
let obj = {
|
||||||
|
...element,
|
||||||
|
children: redata,
|
||||||
|
expanded: true, // 展开子节点
|
||||||
|
}
|
||||||
|
newarr.push(obj)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return newarr
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 引入字体图标 */
|
/* 引入字体图标 */
|
||||||
/* @import './iconfont.css'; */
|
/* @import './iconfont.css'; */
|
||||||
.ep-picker-box {
|
.ep-picker-box {
|
||||||
/* width:100%; */
|
/* width:100%; */
|
||||||
/* box-sizing: border-box; */
|
/* box-sizing: border-box; */
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
color: #0F274B;
|
color: #0f274b;
|
||||||
width: 130rpx;
|
width: 130rpx;
|
||||||
height: 48rpx;
|
height: 48rpx;
|
||||||
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
border-radius: 12rpx 12rpx 12rpx 12rpx;
|
||||||
/* border: 2rpx solid #3888FF; */
|
/* border: 2rpx solid #3888FF; */
|
||||||
background:#fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ep-mask-box {
|
.ep-mask-box {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 99999;
|
z-index: 99999;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background: none;
|
background: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ep-input-box {
|
.ep-input-box {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display:flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 展开收起箭头样式 */
|
/* 展开收起箭头样式 */
|
||||||
.ep-input-box .iconfont {
|
.ep-input-box .iconfont {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
right: 5px;
|
right: 5px;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
color: #B8B8B8;
|
color: #b8b8b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 下拉容器样式 外层 */
|
/* 下拉容器样式 外层 */
|
||||||
.ep-picker-content-wrap {
|
.ep-picker-content-wrap {
|
||||||
max-height: 48vh;
|
max-height: 48vh;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 88rpx;
|
top: 88rpx;
|
||||||
left: 0;
|
left: 0;
|
||||||
z-index: 999999;
|
z-index: 999999;
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 下拉容器样式 内层 */
|
/* 下拉容器样式 内层 */
|
||||||
.ep-picker-content-wrap .ep-picker-content {
|
.ep-picker-content-wrap .ep-picker-content {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
color: #999;
|
color: #999;
|
||||||
padding: 3px 0;
|
padding: 3px 0;
|
||||||
box-shadow: 0 0 20rpx 5rpx rgb(0 0 0 / 30%);
|
box-shadow: 0 0 20rpx 5rpx rgb(0 0 0 / 30%);
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
max-height: 46vh;
|
max-height: 46vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 下拉项通用样式 */
|
/* 下拉项通用样式 */
|
||||||
.ep-picker-content-wrap .ep-picker-content .option-item {
|
.ep-picker-content-wrap .ep-picker-content .option-item {
|
||||||
padding: 20rpx 12rpx 14rpx;
|
padding: 20rpx 12rpx 14rpx;
|
||||||
font-size: 20rpx;
|
font-size: 20rpx;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
border-bottom: 1rpx solid #DFDDDD;
|
border-bottom: 1rpx solid #dfdddd;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ep-picker-content-wrap .ep-picker-content .option-item:last-child {
|
.ep-picker-content-wrap .ep-picker-content .option-item:last-child {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 无下拉项数据时样式 */
|
/* 无下拉项数据时样式 */
|
||||||
.ep-picker-content-wrap .ep-picker-content .option-no-data {
|
.ep-picker-content-wrap .ep-picker-content .option-no-data {
|
||||||
padding: 8px 18px;
|
padding: 8px 18px;
|
||||||
cursor: text;
|
cursor: text;
|
||||||
color: #999;
|
color: #999;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 鼠标移入下拉项样式 */
|
/* 鼠标移入下拉项样式 */
|
||||||
.ep-picker-content-wrap .ep-picker-content .option-item:hover {
|
.ep-picker-content-wrap .ep-picker-content .option-item:hover {
|
||||||
background-color: #f5f7fa;
|
background-color: #f5f7fa;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 已选中的下拉项样式 */
|
/* 已选中的下拉项样式 */
|
||||||
.ep-picker-content-wrap .ep-picker-content .option-item.active {
|
.ep-picker-content-wrap .ep-picker-content .option-item.active {
|
||||||
/* color: #007AFF; */
|
/* color: #007AFF; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 下拉容器指示箭头样式 */
|
||||||
|
.ep-picker-content-wrap .triangle {
|
||||||
/* 下拉容器指示箭头样式 */
|
width: 0;
|
||||||
.ep-picker-content-wrap .triangle {
|
height: 0;
|
||||||
width: 0;
|
border-top: 6px solid rgba(0, 0, 0, 0);
|
||||||
height: 0;
|
border-right: 6px solid rgba(0, 0, 0, 0);
|
||||||
border-top: 6px solid rgba(0, 0, 0, 0);
|
border-bottom: 6px solid #fff;
|
||||||
border-right: 6px solid rgba(0, 0, 0, 0);
|
border-left: 6px solid rgba(0, 0, 0, 0);
|
||||||
border-bottom: 6px solid #fff;
|
position: absolute;
|
||||||
border-left: 6px solid rgba(0, 0, 0, 0);
|
top: -6px;
|
||||||
position: absolute;
|
left: 50%;
|
||||||
top: -6px;
|
transform: translateX(-50%);
|
||||||
left: 50%;
|
box-sizing: content-box;
|
||||||
transform: translateX(-50%);
|
}
|
||||||
box-sizing: content-box;
|
</style>
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
|
||||||
|
|
@ -140,10 +140,10 @@
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row> -->
|
</uni-row> -->
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||||
<uni-col :span="6">物资类型:</uni-col>
|
<uni-col :span="6">规格型号:</uni-col>
|
||||||
<uni-col :span="18">
|
<uni-col :span="18">
|
||||||
<eselect
|
<eselect
|
||||||
v-model="selectTypeId"
|
:value="selectTypeId"
|
||||||
style="width: 100%; height: 90rpx; margin: 10px 0"
|
style="width: 100%; height: 90rpx; margin: 10px 0"
|
||||||
ref="treeSelect"
|
ref="treeSelect"
|
||||||
:options="typeOptions"
|
:options="typeOptions"
|
||||||
|
|
@ -151,6 +151,12 @@
|
||||||
></eselect>
|
></eselect>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||||
|
<uni-col :span="6">物资类型:</uni-col>
|
||||||
|
<uni-col :span="16">
|
||||||
|
{{ typeName }}
|
||||||
|
</uni-col>
|
||||||
|
</uni-row>
|
||||||
|
|
||||||
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
<uni-row :gutter="24" style="display: flex; align-items: center; margin-bottom: 10px">
|
||||||
<uni-col :span="6">外观判定:</uni-col>
|
<uni-col :span="6">外观判定:</uni-col>
|
||||||
|
|
@ -198,9 +204,10 @@
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<scroll-view
|
<scroll-view
|
||||||
|
v-if="typeList.length > 0"
|
||||||
scroll-y
|
scroll-y
|
||||||
@scrolltolower="onScrollTolower"
|
@scrolltolower="onScrollTolower"
|
||||||
style="flex: 1; overflow: auto; min-height: 160px"
|
style="flex: 1; overflow: auto"
|
||||||
>
|
>
|
||||||
<div class="card" style="margin-top: 10px">
|
<div class="card" style="margin-top: 10px">
|
||||||
<uni-row
|
<uni-row
|
||||||
|
|
@ -362,9 +369,20 @@ const getCodeList = async () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
typeList.value.forEach((item) => {
|
const combinedList = [...selectCodeList.value, ...typeList.value]
|
||||||
item.checked = selectCodeList.value.some((selected) => selected.maCode === item.maCode)
|
|
||||||
})
|
// 根据 maCode 去重,保留最前面的项
|
||||||
|
const seen = new Set()
|
||||||
|
const uniqueList = []
|
||||||
|
for (const item of combinedList) {
|
||||||
|
if (!seen.has(item.maCode)) {
|
||||||
|
seen.add(item.maCode)
|
||||||
|
uniqueList.push(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新 typeList
|
||||||
|
typeList.value = uniqueList
|
||||||
|
|
||||||
console.log('🚀 ~ getCodeList ~ typeList.value:', typeList.value)
|
console.log('🚀 ~ getCodeList ~ typeList.value:', typeList.value)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
@ -377,10 +395,13 @@ const getCodeList = async () => {
|
||||||
|
|
||||||
// 选择型号
|
// 选择型号
|
||||||
const changeType = (e) => {
|
const changeType = (e) => {
|
||||||
selectCodeList.value = []
|
if (selectTypeId.value != e.typeId) {
|
||||||
console.log('🚀 ~ changeType ~ e:', e)
|
selectCodeList.value = []
|
||||||
selectTypeId.value = e.typeId
|
console.log('🚀 ~ changeType ~ e:', e)
|
||||||
console.log('🚀 ~ changeType ~ :', selectTypeId.value)
|
typeName.value = e.materialName
|
||||||
|
selectTypeId.value = e.typeId
|
||||||
|
console.log('🚀 ~ changeType ~ :', selectTypeId.value)
|
||||||
|
}
|
||||||
getCodeList()
|
getCodeList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -396,7 +417,7 @@ const handleItemChecked = (item) => {
|
||||||
console.log('🚀 ~ handleItemChecked ~ item:', item)
|
console.log('🚀 ~ handleItemChecked ~ item:', item)
|
||||||
item.checked = !item.checked
|
item.checked = !item.checked
|
||||||
if (item.checked) {
|
if (item.checked) {
|
||||||
selectCodeList.value.push(item)
|
selectCodeList.value.unshift(item)
|
||||||
} else {
|
} else {
|
||||||
selectCodeList.value = selectCodeList.value.filter((el) => el.maCode !== item.maCode)
|
selectCodeList.value = selectCodeList.value.filter((el) => el.maCode !== item.maCode)
|
||||||
}
|
}
|
||||||
|
|
@ -481,6 +502,8 @@ const getMaInfo = () => {
|
||||||
const qrCode = ref('') //图片展示
|
const qrCode = ref('') //图片展示
|
||||||
// 二维码扫码
|
// 二维码扫码
|
||||||
const scanStart = async () => {
|
const scanStart = async () => {
|
||||||
|
qrCode.value = '201909-00100'
|
||||||
|
getMaInfoScan()
|
||||||
qrCode.value = ''
|
qrCode.value = ''
|
||||||
if (scanQrCodeRef.value) {
|
if (scanQrCodeRef.value) {
|
||||||
scanQrCodeRef.value.scanQrCode()
|
scanQrCodeRef.value.scanQrCode()
|
||||||
|
|
@ -528,16 +551,57 @@ const getMaInfoScan = () => {
|
||||||
}
|
}
|
||||||
console.log('xxxxxxxxxxxxxxxx', res)
|
console.log('xxxxxxxxxxxxxxxx', res)
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
if (selectTypeId.value && selectTypeId.value != Number(res.data[0].typeId)) {
|
||||||
|
// 请添加同一类型的设备
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '请添加同一类型的设备',
|
||||||
|
showCancel: false,
|
||||||
|
confirmText: '关闭',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
console.log(res)
|
console.log(res)
|
||||||
console.log(res.data[0])
|
console.log(res.data[0])
|
||||||
maCode.value = res.data[0].maCode
|
// maCode.value = res.data[0].maCode
|
||||||
console.log('333333333333', maCode.value)
|
|
||||||
console.log('codeList:', JSON.stringify(codeList.value))
|
|
||||||
typeName.value = res.data[0].typeName
|
typeName.value = res.data[0].typeName
|
||||||
materialName.value = res.data[0].typeModelName
|
materialName.value = res.data[0].typeModelName
|
||||||
maStatusName.value = res.data[0].maStatusName
|
// maStatusName.value = res.data[0].maStatusName
|
||||||
maId.value = res.data[0].maId
|
// maId.value = res.data[0].maId
|
||||||
typeId.value = res.data[0].typeId
|
selectTypeId.value = Number(res.data[0].typeId)
|
||||||
|
console.log('🚀 ~ getMaInfoScan ~ selectTypeId.value:', selectTypeId.value)
|
||||||
|
|
||||||
|
if (typeList.value.some((item) => item.maId == Number(res.data[0].maId))) {
|
||||||
|
// 设置当前选项为选中
|
||||||
|
typeList.value.forEach((item) => {
|
||||||
|
if (item.maId == res.data[0].maId) {
|
||||||
|
item.checked = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (!selectCodeList.value.some((item) => item.maId === res.data[0].maId)) {
|
||||||
|
selectCodeList.value.unshift({
|
||||||
|
...res.data[0],
|
||||||
|
checked: true,
|
||||||
|
})
|
||||||
|
uni.showToast({ title: '添加成功', icon: 'none' })
|
||||||
|
} else {
|
||||||
|
uni.showToast({ title: '当前设备已添加', icon: 'none' })
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
typeList.value.unshift({
|
||||||
|
...res.data[0],
|
||||||
|
checked: true,
|
||||||
|
})
|
||||||
|
if (!selectCodeList.value.some((item) => item.maId === res.data[0].maId)) {
|
||||||
|
selectCodeList.value.unshift({
|
||||||
|
...res.data[0],
|
||||||
|
checked: true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
uni.showToast({ title: '添加成功', icon: 'none' })
|
||||||
|
}
|
||||||
|
|
||||||
|
isAllChecked()
|
||||||
flag.value = true
|
flag.value = true
|
||||||
} else {
|
} else {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
|
|
@ -545,11 +609,6 @@ const getMaInfoScan = () => {
|
||||||
content: res.msg,
|
content: res.msg,
|
||||||
showCancel: false, // 不显示取消按钮
|
showCancel: false, // 不显示取消按钮
|
||||||
confirmText: '关闭',
|
confirmText: '关闭',
|
||||||
success: (res) => {
|
|
||||||
// if (res.confirm) {
|
|
||||||
// console.log('用户点击关闭')
|
|
||||||
// }
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -664,7 +723,9 @@ const submitCode = () => {
|
||||||
imgList.value = []
|
imgList.value = []
|
||||||
selectCodeList.value = []
|
selectCodeList.value = []
|
||||||
// getMaCodeList()
|
// getMaCodeList()
|
||||||
getCodeList()
|
if (selectTypeId.value) {
|
||||||
|
getCodeList()
|
||||||
|
}
|
||||||
// uni.navigateBack({
|
// uni.navigateBack({
|
||||||
// delta: 1 // 返回到已存在的页面
|
// delta: 1 // 返回到已存在的页面
|
||||||
// });
|
// });
|
||||||
|
|
@ -888,7 +949,7 @@ onLoad((options) => {
|
||||||
background-color: #f7f8fa;
|
background-color: #f7f8fa;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
min-height: 100vh; // 关键,撑满整个视口高度
|
height: 100vh; // 关键,撑满整个视口高度
|
||||||
|
|
||||||
// 卡片样式
|
// 卡片样式
|
||||||
.card {
|
.card {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue