Commit a002b6c6 by zhuxiaomei

赋值的问题

parent 2113b1d7
...@@ -38,7 +38,13 @@ ...@@ -38,7 +38,13 @@
return { return {
showHighSearch: false, showHighSearch: false,
searchValue: '', searchValue: '',
labelText: this.label ? this.label : '关键字' }
},
computed: {
labelText: {
get() {
return this.label ? this.label : '关键字'
},
} }
}, },
watch: { watch: {
......
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.firstClass" v-model="sample.firstClass"
label="大类" label="大类"
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.secondClass" v-model="sample.secondClass"
label="亚类" label="亚类"
...@@ -324,7 +324,7 @@ ...@@ -324,7 +324,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.thirdClass" v-model="sample.thirdClass"
label="次亚类" label="次亚类"
...@@ -335,7 +335,7 @@ ...@@ -335,7 +335,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.fourthClass" v-model="sample.fourthClass"
label="细类" label="细类"
...@@ -1131,7 +1131,7 @@ ...@@ -1131,7 +1131,7 @@
}, },
_scanResult(result) { _scanResult(result) {
for (let key in this.sample) { for (let key in this.sample) {
if (result[key]) { if (result[key]!=='') {
if (key === 'sampleDate') { if (key === 'sampleDate') {
this.sample[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : '' this.sample[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') { } else if (key === 'storageCondition') {
...@@ -1209,7 +1209,7 @@ ...@@ -1209,7 +1209,7 @@
let result = await samplingSummary.getById(this.id) let result = await samplingSummary.getById(this.id)
if (result) { if (result) {
for (let key in this.formObj) { for (let key in this.formObj) {
if (result[key]) { if (result[key]!=='') {
if (key === 'samplingDate') { if (key === 'samplingDate') {
this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : '' this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else { } else {
...@@ -1218,12 +1218,12 @@ ...@@ -1218,12 +1218,12 @@
} }
} }
for (let key in this.nonNetTested) { for (let key in this.nonNetTested) {
if (result.nonNetTested[key]) { if (result.nonNetTested[key]!=='') {
this.nonNetTested[key] = result.nonNetTested[key] this.nonNetTested[key] = result.nonNetTested[key]
} }
} }
for (let key in this.sample) { for (let key in this.sample) {
if (result.sample[key]) { if (result.sample[key]!=='') {
if (key === 'sampleDate') { if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : '' this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') { } else if (key === 'storageCondition') {
......
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.firstClass" v-model="sample.firstClass"
label="大类" label="大类"
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.secondClass" v-model="sample.secondClass"
label="亚类" label="亚类"
...@@ -319,7 +319,7 @@ ...@@ -319,7 +319,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.thirdClass" v-model="sample.thirdClass"
label="次亚类" label="次亚类"
...@@ -330,7 +330,7 @@ ...@@ -330,7 +330,7 @@
<table-col> <table-col>
<van-field <van-field
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.fourthClass" v-model="sample.fourthClass"
label="细类" label="细类"
...@@ -1068,7 +1068,7 @@ ...@@ -1068,7 +1068,7 @@
}, },
_scanResult(result) { _scanResult(result) {
for (let key in this.sample) { for (let key in this.sample) {
if (result[key]) { if (result[key]!=='') {
if (key === 'sampleDate') { if (key === 'sampleDate') {
this.sample[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : '' this.sample[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') { } else if (key === 'storageCondition') {
...@@ -1147,7 +1147,7 @@ ...@@ -1147,7 +1147,7 @@
let result = await samplingSummary.getById(this.id) let result = await samplingSummary.getById(this.id)
if (result) { if (result) {
for (let key in this.formObj) { for (let key in this.formObj) {
if (result[key]) { if (result[key]!=='') {
if (key === 'samplingDate') { if (key === 'samplingDate') {
this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : '' this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else { } else {
...@@ -1156,12 +1156,12 @@ ...@@ -1156,12 +1156,12 @@
} }
} }
for (let key in this.netTested) { for (let key in this.netTested) {
if (result.netTested[key]) { if (result.netTested[key]!=='') {
this.netTested[key] = result.netTested[key] this.netTested[key] = result.netTested[key]
} }
} }
for (let key in this.sample) { for (let key in this.sample) {
if (result.sample[key]) { if (result.sample[key]!=='') {
if (key === 'sampleDate') { if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : '' this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') { } else if (key === 'storageCondition') {
......
...@@ -294,7 +294,7 @@ ...@@ -294,7 +294,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.firstClass" v-model="sample.firstClass"
label="大类" label="大类"
...@@ -303,7 +303,7 @@ ...@@ -303,7 +303,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.secondClass" v-model="sample.secondClass"
label="亚类" label="亚类"
...@@ -314,7 +314,7 @@ ...@@ -314,7 +314,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.thirdClass" v-model="sample.thirdClass"
label="次亚类" label="次亚类"
...@@ -323,7 +323,7 @@ ...@@ -323,7 +323,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.fourthClass" v-model="sample.fourthClass"
label="细类" label="细类"
...@@ -954,7 +954,7 @@ ...@@ -954,7 +954,7 @@
let result = await samplingSummary.getById(this.id) let result = await samplingSummary.getById(this.id)
if (result) { if (result) {
for (let key in this.formObj) { for (let key in this.formObj) {
if (result[key]) { if (result[key]!=='') {
if (key === 'samplingDate') { if (key === 'samplingDate') {
this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : '' this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else { } else {
...@@ -963,12 +963,12 @@ ...@@ -963,12 +963,12 @@
} }
} }
for(let key in this.nonNetTested){ for(let key in this.nonNetTested){
if(result.nonNetTested[key]){ if(result.nonNetTested[key]!==''){
this.nonNetTested[key] = result.nonNetTested[key] this.nonNetTested[key] = result.nonNetTested[key]
} }
} }
for(let key in this.sample){ for(let key in this.sample){
if(result.sample[key]){ if(result.sample[key]!==''){
if (key === 'sampleDate') { if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : '' this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
}else if(key==='storageCondition'){ }else if(key==='storageCondition'){
......
...@@ -290,7 +290,7 @@ ...@@ -290,7 +290,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.firstClass" v-model="sample.firstClass"
label="大类" label="大类"
...@@ -299,7 +299,7 @@ ...@@ -299,7 +299,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.secondClass" v-model="sample.secondClass"
label="亚类" label="亚类"
...@@ -310,7 +310,7 @@ ...@@ -310,7 +310,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.thirdClass" v-model="sample.thirdClass"
label="次亚类" label="次亚类"
...@@ -319,7 +319,7 @@ ...@@ -319,7 +319,7 @@
<table-col> <table-col>
<van-field readonly <van-field readonly
label-class="cus-field-class" label-class="cus-field-class"
label-width="50%" label-width="25%"
label-align="center" label-align="center"
v-model="sample.fourthClass" v-model="sample.fourthClass"
label="细类" label="细类"
...@@ -932,7 +932,7 @@ ...@@ -932,7 +932,7 @@
let result = await samplingSummary.getById(this.id) let result = await samplingSummary.getById(this.id)
if (result) { if (result) {
for (let key in this.formObj) { for (let key in this.formObj) {
if (result[key]) { if (result[key]!=='') {
if (key === 'samplingDate') { if (key === 'samplingDate') {
this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : '' this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else { } else {
...@@ -941,12 +941,12 @@ ...@@ -941,12 +941,12 @@
} }
} }
for (let key in this.netTested) { for (let key in this.netTested) {
if (result.netTested[key]) { if (result.netTested[key]!=='') {
this.netTested[key] = result.netTested[key] this.netTested[key] = result.netTested[key]
} }
} }
for (let key in this.sample) { for (let key in this.sample) {
if (result.sample[key]) { if (result.sample[key]!=='') {
if (key === 'sampleDate') { if (key === 'sampleDate') {
this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : '' this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
} else if(key==='storageCondition'){ } else if(key==='storageCondition'){
......
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
}) })
}, },
_getSample: async function (data) { _getSample: async function (data) {
console.log(data, 'data') console.log(data,'data')
let res = await samplingSample.scanSample({num: data}) let res = await samplingSample.scanSample({qrcode: '123456'})
if (res) { if (res) {
this.$emit('on-result-change', res) this.$emit('on-result-change', res)
barcode.close(); barcode.close();
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
:safe-area-inset-bottom="true" :safe-area-inset-bottom="true"
:close-on-popstate="true"> :close-on-popstate="true">
<div style="height: 70vh;overflow: hidden;background: #f7f8fa"> <div style="height: 70vh;overflow: hidden;background: #f7f8fa">
<search-bar ref="searchBar" :label="level===0?'大类':level===1?'亚类':level===2?'次亚类':'细类'" :fixed="false" <search-bar ref="searchBar" :label="label" :fixed="false"
@search="_search"></search-bar> @search="_search"></search-bar>
<div style="height:calc(100% - 55px);overflow:auto"> <div style="height:calc(100% - 55px);overflow:auto">
<div class="result-item" v-for="item in resultList" :key="item" <div class="result-item" v-for="item in resultList" :key="item"
@click="_tapResult(item)"> @click="_tapResult(item)">
<div> {{item}}</div> <div>{{item}}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
return { return {
key: '', key: '',
resultList: [], resultList: [],
label: '',
level: '', level: '',
pname: '', pname: '',
showPicker: false showPicker: false
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
this.level = level this.level = level
this.pname = pname this.pname = pname
this.key = '' this.key = ''
this.label = level === 0 ? '大类' : level === 1 ? '亚类' : level === 2 ? '次亚类' : '细类'
this.$nextTick(function () { this.$nextTick(function () {
this.$refs.searchBar.searchValue = '' this.$refs.searchBar.searchValue = ''
}) })
......
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 to comment