Commit 2113b1d7 by zhuxiaomei

字段搜索查询优化

parent cdefca66
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
}, },
"globals": { "globals": {
"BMap": true, "BMap": true,
"plus": true "plus": true,
"mui": true
}, },
"rules": {} "rules": {}
}, },
......
...@@ -8,6 +8,7 @@ document.addEventListener('touchstart',function(){ ...@@ -8,6 +8,7 @@ document.addEventListener('touchstart',function(){
document.addEventListener('plusready', function() { document.addEventListener('plusready', function() {
var webview = plus.webview.currentWebview().setStyle({scrollIndicator:'none'}); var webview = plus.webview.currentWebview().setStyle({scrollIndicator:'none'});
plus.key.addEventListener('backbutton', function() { plus.key.addEventListener('backbutton', function() {
console.log(webview.canBack,'webview.canBack')
webview.canBack(function(e) { webview.canBack(function(e) {
if(e.canBack) { if(e.canBack) {
webview.back(); webview.back();
......
/**
* 双随机抽样货架表相关
*/
import http from '../../api/http'
export default {
getTested: data => http.post('/drs/v1/net_tested/get_tested_by_name',data).then(res => res),
}
/**
* 双随机抽样货架表相关
*/
import http from '../../api/http'
export default {
getTested: data => http.post('/drs/v1/non_net_tested/get_tested_by_name',data).then(res => res),
}
/**
* 双随机抽样货架表相关
*/
import http from '../../api/http'
export default {
scanSample: data => http.post('/drs/v1/sampling_sample/scan_sample', data).then(res => res),
}
...@@ -11,4 +11,6 @@ export default { ...@@ -11,4 +11,6 @@ export default {
deleteByIds: ids => http.delete('/drs/v1/sampling_summary/?ids=' + ids).then(res => res), deleteByIds: ids => http.delete('/drs/v1/sampling_summary/?ids=' + ids).then(res => res),
getById: id => http.get('/drs/v1/sampling_summary/' + id).then(res => res), getById: id => http.get('/drs/v1/sampling_summary/' + id).then(res => res),
lastTester: () => http.post('/drs/v1/sampling_summary/last_tester').then(res => res), lastTester: () => http.post('/drs/v1/sampling_summary/last_tester').then(res => res),
getTester: data => http.post('/drs/v1/sampling_summary/get_tester_by_name',data).then(res => res),
getProducter: data => http.post('/drs/v1/sampling_summary/get_producter_by_name',data).then(res => res),
} }
/**
* 相关食品类别
*/
import http from '../../api/http'
export default {
// 默认大类-pid为0 根据类别pid获取下拉数据
categoryList:data=>http.post('/food/v1/classify_info/list_by_name', data).then(res=>res),
}
...@@ -24,6 +24,10 @@ export {default as advise} from './base/advise' ...@@ -24,6 +24,10 @@ export {default as advise} from './base/advise'
*/ */
export {default as message} from './message/message' export {default as message} from './message/message'
/** /**
* food
*/
export {default as foodClassifyInfo} from './food/food-classify-info'
/**
* drs * drs
*/ */
export {default as samplingPlan} from './drs/sampling-plan' export {default as samplingPlan} from './drs/sampling-plan'
...@@ -32,3 +36,6 @@ export {default as samplingShelf} from './drs/sampling-shelf' ...@@ -32,3 +36,6 @@ export {default as samplingShelf} from './drs/sampling-shelf'
export {default as samplingSummary} from './drs/sampling-summary' export {default as samplingSummary} from './drs/sampling-summary'
export {default as samplingSummaryAttachment} from './drs/sampling-summary-attachment' export {default as samplingSummaryAttachment} from './drs/sampling-summary-attachment'
export {default as attendanceRecord} from './drs/attendance_record' export {default as attendanceRecord} from './drs/attendance_record'
export {default as samplingSample} from './drs/sampling-sample'
export {default as netTested} from './drs/net-tested'
export {default as nonNetTested} from './drs/non-net-tested'
<template> <template>
<!--https://youzan.github.io/vant/#/zh-CN/search--> <!--https://youzan.github.io/vant/#/zh-CN/search-->
<div class="search-bar-box"> <div class="search-bar-box-fixed-top" :class="{'search-bar-box':fixed===false}">
<van-search <van-search
v-model="searchValue" v-model="searchValue"
show-action show-action
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
props: { props: {
label: String, label: String,
//是否展示高级查询按钮 //是否展示高级查询按钮
highSearch: {type: Boolean, default: false} highSearch: {type: Boolean, default: false},
fixed: {type: Boolean, default: true}
}, },
data() { data() {
return { return {
...@@ -40,6 +41,21 @@ ...@@ -40,6 +41,21 @@
labelText: this.label ? this.label : '关键字' labelText: this.label ? this.label : '关键字'
} }
}, },
watch: {
showHighSearch: function (val) {
let that = this
mui.init({
beforeback: function () {
if (val) {
that._hideHighSearch()
return false;
} else {
return true
}
}
});
}
},
methods: { methods: {
onSearch() { onSearch() {
this.$emit('search', this.searchValue) this.$emit('search', this.searchValue)
...@@ -48,7 +64,7 @@ ...@@ -48,7 +64,7 @@
this.searchValue = '' this.searchValue = ''
this.$emit('high-search') this.$emit('high-search')
}, },
_hideHighSearch(){ _hideHighSearch() {
this.showHighSearch = false this.showHighSearch = false
}, },
onReset() { onReset() {
......
...@@ -62,6 +62,8 @@ ...@@ -62,6 +62,8 @@
label-align="center" label-align="center"
v-model="nonNetTested.name" v-model="nonNetTested.name"
label="单位名称" label="单位名称"
right-icon="add-o"
@click-right-icon="_companySelect('nonNetTested.name')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -276,7 +278,7 @@ ...@@ -276,7 +278,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.trademark" v-model="sample.trademark"
label="商标" label="商标"
...@@ -285,10 +287,12 @@ ...@@ -285,10 +287,12 @@
<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.qrcode" v-model="sample.qrcode"
label="条形码" label="条形码"
right-icon="scan"
@click-right-icon="_scan"
></van-field> ></van-field>
</table-col> </table-col>
</table-row> </table-row>
...@@ -300,6 +304,8 @@ ...@@ -300,6 +304,8 @@
label-align="center" label-align="center"
v-model="sample.firstClass" v-model="sample.firstClass"
label="大类" label="大类"
right-icon="add-o"
@click-right-icon="_classSelect('大类')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -309,6 +315,8 @@ ...@@ -309,6 +315,8 @@
label-align="center" label-align="center"
v-model="sample.secondClass" v-model="sample.secondClass"
label="亚类" label="亚类"
right-icon="add-o"
@click-right-icon="_classSelect('亚类')"
></van-field> ></van-field>
</table-col> </table-col>
</table-row> </table-row>
...@@ -320,6 +328,8 @@ ...@@ -320,6 +328,8 @@
label-align="center" label-align="center"
v-model="sample.thirdClass" v-model="sample.thirdClass"
label="次亚类" label="次亚类"
right-icon="add-o"
@click-right-icon="_classSelect('次亚类')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -329,6 +339,8 @@ ...@@ -329,6 +339,8 @@
label-align="center" label-align="center"
v-model="sample.fourthClass" v-model="sample.fourthClass"
label="细类" label="细类"
right-icon="add-o"
@click-right-icon="_classSelect('细类')"
></van-field> ></van-field>
</table-col> </table-col>
</table-row> </table-row>
...@@ -613,6 +625,8 @@ ...@@ -613,6 +625,8 @@
label-align="center" label-align="center"
v-model="formObj.proName" v-model="formObj.proName"
label="生产者名称" label="生产者名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.proName')"
></van-field> ></van-field>
</table-col> </table-col>
</table-row> </table-row>
...@@ -730,6 +744,8 @@ ...@@ -730,6 +744,8 @@
label-align="center" label-align="center"
v-model="formObj.testName" v-model="formObj.testName"
label="单位名称" label="单位名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.testName')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -819,6 +835,12 @@ ...@@ -819,6 +835,12 @@
@cancel="showCityPicker=false" @cancel="showCityPicker=false"
></van-area> ></van-area>
</van-popup> </van-popup>
<SelectClass ref="class" @on-result-change="_classResult"></SelectClass>
<SelectTester ref="tester" @on-result-change="_testerResult"></SelectTester>
<SelectProducter ref="producter" @on-result-change="_producterResult"></SelectProducter>
<SelectTested ref="tested" @on-result-change="_testedResult"></SelectTested>
<ScanBar ref="scan" @on-result-change="_scanResult"></ScanBar>
</div> </div>
</template> </template>
...@@ -828,13 +850,23 @@ ...@@ -828,13 +850,23 @@
import TableCol from './components/TableCol' import TableCol from './components/TableCol'
import {samplingSummary} from '../../api' import {samplingSummary} from '../../api'
import {default as areaList} from '../../lib/area' import {default as areaList} from '../../lib/area'
import SelectClass from './components/SelectClass'
import SelectTester from './components/SelectTester'
import SelectProducter from './components/SelectProducter'
import SelectTested from './components/SelectTested'
import ScanBar from './components/ScanBar'
export default { export default {
name: "SamplingListAdd", name: "SamplingListAdd",
components: { components: {
"add-table": SamplingListAddTable, "add-table": SamplingListAddTable,
"table-row": TableRow, "table-row": TableRow,
"table-col": TableCol "table-col": TableCol,
SelectClass,
SelectTester,
SelectProducter,
SelectTested,
ScanBar
}, },
data() { data() {
return { return {
...@@ -1053,6 +1085,114 @@ ...@@ -1053,6 +1085,114 @@
this._getLastTester() this._getLastTester()
} }
}, },
_companySelect(type) {
switch (type) {
case 'nonNetTested.name':
this.$refs.tested._open()
break
case 'formObj.proName':
this.$refs.producter._open()
break
case 'formObj.testName':
this.$refs.tester._open()
break
}
},
_testerResult(res) {
this.formObj.testName = res.testName ? res.testName : ''
this.formObj.testAddress = res.testAddress ? res.testAddress : ''
this.formObj.testLinkman = res.testLinkman ? res.testLinkman : ''
this.formObj.testTel = res.testTel ? res.testTel : ''
this.formObj.testEmail = res.testEmail ? res.testEmail : ''
this.formObj.testFax = res.testFax ? res.testFax : ''
},
_producterResult(res) {
this.formObj.proName = res.proName ? res.proName : ''
this.formObj.proAddress = res.proAddress ? res.proAddress : ''
this.formObj.proLicense = res.proLicense ? res.proLicense : ''
this.formObj.proTel = res.proTel ? res.proTel : ''
},
_testedResult(res) {
this.nonNetTested.name = res.name ? res.name : ''
this.nonNetTested.testedProvince = res.testedProvince ? res.testedProvince : ''
this.nonNetTested.testedCity = res.testedCity ? res.testedCity : ''
this.nonNetTested.testedCountry = res.testedCountry ? res.testedCountry : ''
this.nonNetTested.address = res.address ? res.address : ''
this.nonNetTested.areaType = res.areaType ? res.areaType : ''
this.nonNetTested.permitType = res.permitType ? res.permitType : ''
this.nonNetTested.permitNum = res.permitNum ? res.permitNum : ''
this.nonNetTested.legalPerson = res.legalPerson ? res.legalPerson : ''
this.nonNetTested.linkman = res.linkman ? res.linkman : ''
this.nonNetTested.license = res.license ? res.license : ''
this.nonNetTested.tel = res.tel ? res.tel : ''
},
_scan() {
this.$refs.scan._open()
},
_scanResult(result) {
for (let key in this.sample) {
if (result[key]) {
if (key === 'sampleDate') {
this.sample[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') {
this.storageCondition = result[key].split(',')
this.sample[key] = result[key]
} else {
this.sample[key] = result[key]
}
}
}
},
_classSelect(type) {
switch (type) {
case '大类':
this.$refs.class._open(0)
break
case '亚类':
if (this.sample.firstClass) {
this.$refs.class._open(1, this.sample.firstClass)
} else {
this.$toast('请先选择大类!')
}
break
case '次亚类':
if (this.sample.secondClass) {
this.$refs.class._open(2, this.sample.secondClass)
} else {
this.$toast('请先选择亚类!')
}
break
case '细类':
if (this.sample.thirdClass) {
this.$refs.class._open(3, this.sample.thirdClass)
} else {
this.$toast('请先选择次亚类!')
}
break
}
},
_classResult(res, level) {
switch (level) {
case 0:
this.sample.firstClass = res
this.sample.secondClass = ''
this.sample.thirdClass = ''
this.sample.fourthClass = ''
break
case 1:
this.sample.secondClass = res
this.sample.thirdClass = ''
this.sample.fourthClass = ''
break
case 2:
this.sample.thirdClass = res
this.sample.fourthClass = ''
break
case 3:
this.sample.fourthClass = res
break
}
},
//获取最近填写的抽样单位信息 //获取最近填写的抽样单位信息
_getLastTester: async function () { _getLastTester: async function () {
let result = await samplingSummary.lastTester() let result = await samplingSummary.lastTester()
......
...@@ -128,6 +128,8 @@ ...@@ -128,6 +128,8 @@
label-align="center" label-align="center"
v-model="netTested.name" v-model="netTested.name"
label="单位名称" label="单位名称"
right-icon="add-o"
@click-right-icon="_companySelect('netTested.name')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -297,6 +299,8 @@ ...@@ -297,6 +299,8 @@
label-align="center" label-align="center"
v-model="sample.firstClass" v-model="sample.firstClass"
label="大类" label="大类"
right-icon="add-o"
@click-right-icon="_classSelect('大类')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -306,6 +310,8 @@ ...@@ -306,6 +310,8 @@
label-align="center" label-align="center"
v-model="sample.secondClass" v-model="sample.secondClass"
label="亚类" label="亚类"
right-icon="add-o"
@click-right-icon="_classSelect('亚类')"
></van-field> ></van-field>
</table-col> </table-col>
</table-row> </table-row>
...@@ -317,6 +323,8 @@ ...@@ -317,6 +323,8 @@
label-align="center" label-align="center"
v-model="sample.thirdClass" v-model="sample.thirdClass"
label="次亚类" label="次亚类"
right-icon="add-o"
@click-right-icon="_classSelect('次亚类')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -326,6 +334,8 @@ ...@@ -326,6 +334,8 @@
label-align="center" label-align="center"
v-model="sample.fourthClass" v-model="sample.fourthClass"
label="细类" label="细类"
right-icon="add-o"
@click-right-icon="_classSelect('细类')"
></van-field> ></van-field>
</table-col> </table-col>
</table-row> </table-row>
...@@ -514,16 +524,18 @@ ...@@ -514,16 +524,18 @@
<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.qrcode" v-model="sample.qrcode"
label="条形码" label="条形码"
right-icon="scan"
@click-right-icon="_scan"
></van-field> ></van-field>
</table-col> </table-col>
<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.price" v-model="sample.price"
label="单价" label="单价"
...@@ -609,6 +621,8 @@ ...@@ -609,6 +621,8 @@
label-align="center" label-align="center"
v-model="formObj.proName" v-model="formObj.proName"
label="生产者名称" label="生产者名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.proName')"
></van-field> ></van-field>
</table-col> </table-col>
</table-row> </table-row>
...@@ -726,6 +740,8 @@ ...@@ -726,6 +740,8 @@
label-align="center" label-align="center"
v-model="formObj.testName" v-model="formObj.testName"
label="单位名称" label="单位名称"
right-icon="add-o"
@click-right-icon="_companySelect('formObj.testName')"
></van-field> ></van-field>
</table-col> </table-col>
<table-col> <table-col>
...@@ -817,6 +833,11 @@ ...@@ -817,6 +833,11 @@
></van-area> ></van-area>
</van-popup> </van-popup>
<SelectClass ref="class" @on-result-change="_classResult"></SelectClass>
<SelectTester ref="tester" @on-result-change="_testerResult"></SelectTester>
<SelectProducter ref="producter" @on-result-change="_producterResult"></SelectProducter>
<SelectTested ref="tested" @on-result-change="_testedResult"></SelectTested>
<ScanBar ref="scan" @on-result-change="_scanResult"></ScanBar>
</div> </div>
</template> </template>
...@@ -826,13 +847,23 @@ ...@@ -826,13 +847,23 @@
import TableCol from './components/TableCol' import TableCol from './components/TableCol'
import {samplingSummary} from '../../api' import {samplingSummary} from '../../api'
import {default as areaList} from '../../lib/area' import {default as areaList} from '../../lib/area'
import SelectClass from './components/SelectClass'
import SelectTester from './components/SelectTester'
import SelectProducter from './components/SelectProducter'
import SelectTested from './components/SelectTested'
import ScanBar from './components/ScanBar'
export default { export default {
name: "SamplingListAddNet", name: "SamplingListAddNet",
components: { components: {
"add-table": SamplingListAddTable, "add-table": SamplingListAddTable,
"table-row": TableRow, "table-row": TableRow,
"table-col": TableCol "table-col": TableCol,
SelectClass,
SelectTester,
SelectProducter,
SelectTested,
ScanBar
}, },
data() { data() {
return { return {
...@@ -991,6 +1022,115 @@ ...@@ -991,6 +1022,115 @@
this._getLastTester() this._getLastTester()
} }
}, },
_companySelect(type){
switch (type) {
case 'netTested.name':
this.$refs.tested._open()
break
case 'formObj.proName':
this.$refs.producter._open()
break
case 'formObj.testName':
this.$refs.tester._open()
break
}
},
_testerResult(res){
this.formObj.testName = res.testName ? res.testName : ''
this.formObj.testAddress = res.testAddress ? res.testAddress : ''
this.formObj.testLinkman = res.testLinkman ? res.testLinkman : ''
this.formObj.testTel = res.testTel ? res.testTel : ''
this.formObj.testEmail = res.testEmail ? res.testEmail : ''
this.formObj.testFax = res.testFax ? res.testFax : ''
},
_producterResult(res){
this.formObj.proName = res.proName ? res.proName : ''
this.formObj.proAddress = res.proAddress ? res.proAddress : ''
this.formObj.proLicense = res.proLicense ? res.proLicense : ''
this.formObj.proTel = res.proTel ? res.proTel : ''
},
_testedResult(res){
this.netTested.name = res.name ? res.name : ''
this.netTested.testedProvince = res.testedProvince ? res.testedProvince : ''
this.netTested.testedCity = res.testedCity ? res.testedCity : ''
this.netTested.testedCountry = res.testedCountry ? res.testedCountry : ''
this.netTested.address = res.address ? res.address : ''
this.netTested.estore = res.estore ? res.estore : ''
this.netTested.sampleSite = res.sampleSite ? res.sampleSite : ''
this.netTested.permitType = res.permitType ? res.permitType : ''
this.netTested.permitNum = res.permitNum ? res.permitNum : ''
this.netTested.linkman = res.linkman ? res.linkman : ''
this.netTested.license = res.license ? res.license : ''
this.netTested.tel = res.tel ? res.tel : ''
},
_scan() {
this.$refs.scan._open()
},
_scanResult(result) {
for (let key in this.sample) {
if (result[key]) {
if (key === 'sampleDate') {
this.sample[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
} else if (key === 'storageCondition') {
this.storageCondition = result[key].split(',')
this.sample[key] = result[key]
} else {
this.sample[key] = result[key]
}
}
}
},
//大类 亚类 次亚类 细类 选择
_classSelect(type) {
switch (type) {
case '大类':
this.$refs.class._open(0)
break
case '亚类':
if (this.sample.firstClass) {
this.$refs.class._open(1, this.sample.firstClass)
} else {
this.$toast('请先选择大类!')
}
break
case '次亚类':
if (this.sample.secondClass) {
this.$refs.class._open(2, this.sample.secondClass)
} else {
this.$toast('请先选择亚类!')
}
break
case '细类':
if (this.sample.thirdClass) {
this.$refs.class._open(3, this.sample.thirdClass)
} else {
this.$toast('请先选择次亚类!')
}
break
}
},
_classResult(res, level) {
switch (level) {
case 0:
this.sample.firstClass = res
this.sample.secondClass = ''
this.sample.thirdClass = ''
this.sample.fourthClass = ''
break
case 1:
this.sample.secondClass = res
this.sample.thirdClass = ''
this.sample.fourthClass = ''
break
case 2:
this.sample.thirdClass = res
this.sample.fourthClass = ''
break
case 3:
this.sample.fourthClass = res
break
}
},
//获取最近填写的抽样单位信息 //获取最近填写的抽样单位信息
_getLastTester: async function () { _getLastTester: async function () {
let result = await samplingSummary.lastTester() let result = await samplingSummary.lastTester()
......
<template>
<van-popup v-model="showScan"
:safe-area-inset-bottom="true"
:close-on-popstate="true" :style="{ height: '100%',width:'100%' }">
<van-nav-bar title="扫码"
left-arrow
@click-left="_cancelScan"></van-nav-bar>
<div id="bcid">
<div style="height:40%"></div>
</div>
<div class="bottom-btn">
<van-button block type="default" @click="_cancelScan">取消</van-button>
</div>
</van-popup>
</template>
<style scoped>
#bcid {
width: 100%;
height: calc(100% - 44px - 46px);
text-align: center;
}
</style>
<script>
import {samplingSample} from '../../../api'
var barcode = null;//扫码对象
export default {
data() {
return {
num: '',
showScan: false
}
},
watch: {
showScan: function (val) {
let that = this
//返回键操作
mui.init({
beforeback: function () {
if (val) {
barcode.close();
that.showScan = false
return false;
} else {
return that
}
}
});
}
},
methods: {
_open() {
this.showScan = true
this.$nextTick(function () {
barcode = null;
let that = this;
if (!barcode) {
barcode = new plus.barcode.Barcode('bcid', [plus.barcode.CODE128], {
frameColor: '#00FF00',
scanbarColor: '#00FF00'
});
barcode.onmarked = function (type, result) {
if (type === plus.barcode.CODE128) {
that._getSample(result)
}
};
plus.webview.currentWebview().append(barcode);
}
barcode.start();
})
},
_getSample: async function (data) {
console.log(data, 'data')
let res = await samplingSample.scanSample({num: data})
if (res) {
this.$emit('on-result-change', res)
barcode.close();
this.showScan = false
} else {
this.$toast('扫描失败!')
barcode.close()
this._open()
}
},
_cancelScan() {
barcode.close();
this.showScan = false
},
// _scanPicture() {
// let that = this;
// plus.gallery.pick(function (path) {
// plus.barcode.scan(path, function (type, result) {
// var text = '未知: ';
// switch (type) {
// case plus.barcode.CODE128:
// text = 'CODE128: ';
// break;
// }
// that.$store.dispatch('EnvSample/scanReceive', {num: result}).then(() => {
// if (that.$store.state.EnvSample.success) {
// barcode.close();
// that.$router.go(-1);
// }
// });
// }, function (error) {
// plus.nativeUI.alert('无法识别此图片');
// }, [plus.barcode.CODE128]);
// }, function (err) {
// console.log('Failed: ' + err.message);
// });
// },
}
}
</script>
<template>
<van-popup v-model="showPicker" position="bottom"
:safe-area-inset-bottom="true"
:close-on-popstate="true">
<div style="height: 70vh;overflow: hidden;background: #f7f8fa">
<search-bar ref="searchBar" :label="level===0?'大类':level===1?'亚类':level===2?'次亚类':'细类'" :fixed="false"
@search="_search"></search-bar>
<div style="height:calc(100% - 55px);overflow:auto">
<div class="result-item" v-for="item in resultList" :key="item"
@click="_tapResult(item)">
<div> {{item}}</div>
</div>
</div>
</div>
</van-popup>
</template>
<script>
import {foodClassifyInfo} from '../../../api'
export default {
name: "SelectClass",
data() {
return {
key: '',
resultList: [],
level: '',
pname: '',
showPicker: false
}
},
methods: {
_open(level, pname) {
this.showPicker = true
this.level = level
this.pname = pname
this.key = ''
this.$nextTick(function () {
this.$refs.searchBar.searchValue = ''
})
this._getData()
},
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this._getData()
},
_searchParams() {
let obj = {level: this.level}
if (this.key) {
obj.name = this.key
}
if (this.pname) {
obj.pName = this.pname
}
return obj
},
_getData: async function () {
let result = await foodClassifyInfo.categoryList(this._searchParams())
this.resultList = result
},
_tapResult(item) {
this.$emit('on-result-change', item, this.level)
this.showPicker = false
},
}
}
</script>
<style scoped>
</style>
<template>
<van-popup v-model="showPicker" position="bottom"
:safe-area-inset-bottom="true"
:close-on-popstate="true">
<div style="height: 70vh;overflow: hidden;background: #f7f8fa">
<search-bar ref="searchBar" label="生产者名称" :fixed="false"
@search="_search"></search-bar>
<div style="height:calc(100% - 55px);overflow:auto">
<div class="result-item" v-for="item in resultList" :key="item.id"
@click="_tapResult(item)">
<div> {{item.proName}}</div>
</div>
</div>
</div>
</van-popup>
</template>
<script>
import {samplingSummary} from '../../../api'
export default {
data() {
return {
key: '',
resultList: [],
showPicker: false
}
},
methods: {
_open() {
this.showPicker = true
this.key = ''
this.$nextTick(function () {
this.$refs.searchBar.searchValue = ''
})
this._getData()
},
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this._getData()
},
_searchParams() {
let obj = {}
if (this.key) {
obj.name = this.key
}
return obj
},
_getData: async function () {
let result = await samplingSummary.getProducter(this._searchParams())
this.resultList = result
},
_tapResult(item) {
this.$emit('on-result-change', item)
this.showPicker = false
},
}
}
</script>
<style scoped>
</style>
<template>
<van-popup v-model="showPicker" position="bottom"
:safe-area-inset-bottom="true"
:close-on-popstate="true">
<div style="height: 70vh;overflow: hidden;background: #f7f8fa">
<search-bar ref="searchBar" label="被抽样单位名称" :fixed="false"
@search="_search"></search-bar>
<div style="height:calc(100% - 55px);overflow:auto">
<div class="result-item" v-for="item in resultList" :key="item.id"
@click="_tapResult(item)">
<div> {{item.name}}</div>
</div>
</div>
</div>
</van-popup>
</template>
<script>
import {netTested,nonNetTested} from '../../../api'
export default {
data() {
return {
key: '',
resultList: [],
type: '',
showPicker: false
}
},
methods: {
_open(type) {
this.showPicker = true
this.type = type
this.key = ''
this.$nextTick(function () {
this.$refs.searchBar.searchValue = ''
})
this._getData()
},
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this._getData()
},
_searchParams() {
let obj = {}
if (this.key) {
obj.name = this.key
}
return obj
},
_getData: async function () {
if(this.type==='netTested'){
let result = await netTested.getTested(this._searchParams())
this.resultList = result
}else{
let result = await nonNetTested.getTested(this._searchParams())
this.resultList = result
}
},
_tapResult(item) {
this.$emit('on-result-change', item, this.type)
this.showPicker = false
},
}
}
</script>
<style scoped>
</style>
<template>
<van-popup v-model="showPicker" position="bottom"
:safe-area-inset-bottom="true"
:close-on-popstate="true">
<div style="height: 70vh;overflow: hidden;background: #f7f8fa">
<search-bar ref="searchBar" label="抽样单位名称" :fixed="false"
@search="_search"></search-bar>
<div style="height:calc(100% - 55px);overflow:auto">
<div class="result-item" v-for="item in resultList" :key="item.id"
@click="_tapResult(item)">
<div>{{item.testName}}</div>
</div>
</div>
</div>
</van-popup>
</template>
<script>
import {samplingSummary} from '../../../api'
export default {
data() {
return {
key: '',
resultList: [],
showPicker: false
}
},
methods: {
_open() {
this.showPicker = true
this.key = ''
this.$nextTick(function () {
this.$refs.searchBar.searchValue = ''
})
this._getData()
},
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this._getData()
},
_searchParams() {
let obj = {}
if (this.key) {
obj.name = this.key
}
return obj
},
_getData: async function () {
let result = await samplingSummary.getTester(this._searchParams())
this.resultList = result
},
_tapResult(item) {
this.$emit('on-result-change', item)
this.showPicker = false
},
}
}
</script>
<style scoped>
</style>
...@@ -237,6 +237,11 @@ html, body, #app, .main-content-con { ...@@ -237,6 +237,11 @@ html, body, #app, .main-content-con {
/*search-bar begin */ /*search-bar begin */
.search-bar-box { .search-bar-box {
position: relative !important;
top: 0px !important;
}
.search-bar-box-fixed-top {
position: fixed; position: fixed;
width: 100%; width: 100%;
top: 45px; top: 45px;
......
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