Commit c680e4f8 by zhuxiaomei

分类查询 抽样条码前端 温湿度位置

parent 17564213
NODE_ENV=development NODE_ENV=development
VUE_APP_BASE_URL=http://192.168.0.39:7000 VUE_APP_BASE_URL=http://192.168.0.13:7000
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
* 系统相关 * 系统相关
*/ */
import http from '../http' import http from '../http'
import Global from '../config'
export default { export default {
//检测版本,自动更新 //检测版本,自动更新
version: data => http.post('/base/v1/app_version/' + data.name + '_' + data.device + '?version=' + Global.version()).then(res => res), version: data => http.post('/base/v1/app_version/' + data.name + '_' + data.device + '?version=' + this.$global.version()).then(res => res),
} }
...@@ -5,7 +5,7 @@ export {default as sso} from './base/sso' ...@@ -5,7 +5,7 @@ export {default as sso} from './base/sso'
// export {default as resource} from './base/resource' // export {default as resource} from './base/resource'
// export {default as userRelResource} from './base/user-rel-resource' // export {default as userRelResource} from './base/user-rel-resource'
export {default as sysUser} from './base/user' export {default as sysUser} from './base/user'
// export {default as appVersion} from './base/app-version' export {default as appVersion} from './base/app-version'
// export {default as flowProcess} from './base/flow-process' // export {default as flowProcess} from './base/flow-process'
// export {default as email} from './base/email' // export {default as email} from './base/email'
export {default as sms} from './base/sms' export {default as sms} from './base/sms'
...@@ -25,4 +25,8 @@ export {default as envMonitorRecord} from './res/env-monitor-record' ...@@ -25,4 +25,8 @@ export {default as envMonitorRecord} from './res/env-monitor-record'
*/ */
export {default as message} from './message/message' export {default as message} from './message/message'
/**
* taihe
*/
export {default as sample} from './taihe/sample'
...@@ -9,5 +9,5 @@ export default { ...@@ -9,5 +9,5 @@ export default {
edit: data => http.put('/res/v1/env_monitor/' + data.id, data.obj).then(res => res), edit: data => http.put('/res/v1/env_monitor/' + data.id, data.obj).then(res => res),
deleteByIds: ids => http.delete('/res/v1/env_monitor/?ids=' + ids).then(res => res), deleteByIds: ids => http.delete('/res/v1/env_monitor/?ids=' + ids).then(res => res),
getById: id => http.get('/res/v1/env_monitor/' + id).then(res => res), getById: id => http.get('/res/v1/env_monitor/' + id).then(res => res),
locList: data => http.post('/res/v1/env_monitor/list_location', data).then(res => res),
} }
/**
*
*/
import http from '../http'
export default {
sampleByQrcode: data => http.post('/taihe/v1/sample/sample_by_qrcode', data).then(res => res),
}
...@@ -6,29 +6,54 @@ ...@@ -6,29 +6,54 @@
right-icon="scan" right-icon="scan"
placeholder="请输入或扫码条码" placeholder="请输入或扫码条码"
@click-right-icon="_scan" @click-right-icon="_scan"
@input="_getInfo"
></van-field> ></van-field>
<div class="layout-cont-btn">
<div class="result-item" v-if="noData===false&&Object.keys(sampleInfo).length">
<div style="width: 100%">大类:{{sampleInfo.firstClass}}</div>
<div style="width: 100%">亚类:{{sampleInfo.secondClass}}</div>
<div style="width: 100%">次亚类:{{sampleInfo.thirdClass}}</div>
<div style="width: 100%">细类:{{sampleInfo.detectType}}</div>
</div>
<div style="color: #969799;text-align: center;margin: 10px 0" v-else-if="noData===true">未找到相关数据</div>
</div>
</div> </div>
</template> </template>
<script> <script>
import {mapMutations} from "vuex"; import {mapMutations} from "vuex";
import {sample} from '../api'
export default { export default {
name: "class", name: "class",
data() { data() {
return { return {
code: '' code: '',
sampleInfo: {},
noData: false
} }
}, },
mounted() { mounted() {
this.code = this.$store.state.barcode this.code = this.$store.state.barcode
this.setBarcode() this.setBarcode()
if (this.code) {
this._getInfo()
}
}, },
methods: { methods: {
...mapMutations(["setBarcode"]), ...mapMutations(["setBarcode"]),
_scan() { _scan() {
this.$router.push('/scan_bar') this.$router.push('/scan_bar')
},
_getInfo: async function () {
let result = await sample.sampleByQrcode({qrcode: this.code})
if (result) {
this.sampleInfo = result
this.noData = false
} else {
this.noData = true
}
} }
} }
} }
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
<script> <script>
import {appVersion} from '../api'
export default { export default {
name: "Index", name: "Index",
computed: { computed: {
...@@ -28,8 +30,26 @@ ...@@ -28,8 +30,26 @@
} }
} }
}, },
data() {
return {
newVersion: '',
versionLog: '', //更新日志内容
newVersionUri: '', //更新地址
}
},
mounted() { mounted() {
this._login() this._login()
try {
if (plus.os.name === 'Android') {
//每次进来都给予提示(android)
this._testVersion(0);
} else if (plus.os.name !== 'Android') {
//每次进来都给予提示(ios)
this._testVersion(1);
}
} catch (e) {
//
}
}, },
methods: { methods: {
_login() { _login() {
...@@ -44,7 +64,72 @@ ...@@ -44,7 +64,72 @@
if (this.$route.meta.leftArrow !== false) { if (this.$route.meta.leftArrow !== false) {
this.$router.go(-1) this.$router.go(-1)
} }
} },
//检测新版本
_testVersion: async function (device) {
//device-----0:安卓,1:ios
//name ----- 应用程序名称 随便起,跟梦琪对接好
let result = await appVersion.version({name: 'taihe', device: device})
if (result) {
this.newVersion = result.version;
this.newVersionUri = result.uri;
this.versionLog = result.log;
this._tip(result.required);
}
},
//更新提示
_tip(required) {
let that = this;
this.$dialog.confirm({
title: '检测到新版本',
message: 'v' + that.newVersion + ' 新版本上线!' + this.versionLog,
confirmButtonText: '马上升级',
cancelButtonText: '知道了',
confirmButtonColor: '#1989fa',
showCancelButton: required === 1 ? false : true, //true(required=1) 表示非强制更新,false(required=0) 表示强制更新
}).then(() => {
that._ok();//升级
}).catch(() => {
// on cancel
});
},
//升级
_ok() {
if (plus.os.name) {
if (plus.os.name === 'Android') {
this._androidOk();
} else {
this._iosOk();
}
}
},
_androidOk() {
this.$toast.loading({
message: '下载中...',
forbidClick: true,
});
let url = this.newVersionUri; // 下载文件地址
let dtask = plus.downloader.createDownload(url, {}, (d, status) => {
if (status == 200) {
// 下载成功
this._downApk(d.filename);
} else {
//下载失败
this.$toast('下载失败')
}
});
dtask.start();
},
//跳转到appStore商店
_iosOk() {
plus.runtime.openURL(this.newVersionUri);
},
//下载apk(安卓)
_downApk(filename) {
// 安装下载的apk文件
plus.runtime.install(filename, {}, () => {
});
},
} }
} }
</script> </script>
......
...@@ -35,7 +35,11 @@ ...@@ -35,7 +35,11 @@
} }
}, },
mounted() { mounted() {
this._open() try {
this._open()
} catch (e) {
//
}
//返回键操作 //返回键操作
mui.init({ mui.init({
beforeback: function () { beforeback: function () {
...@@ -50,13 +54,13 @@ ...@@ -50,13 +54,13 @@
barcode = null; barcode = null;
let that = this; let that = this;
if (!barcode) { if (!barcode) {
barcode = new plus.barcode.Barcode('bcid', [plus.barcode.CODE128], { barcode = new plus.barcode.Barcode('bcid', [plus.barcode.CODE128, plus.barcode.EAN13, plus.barcode.EAN8], {
frameColor: '#00FF00', frameColor: '#00FF00',
scanbarColor: '#00FF00' scanbarColor: '#00FF00'
}); });
barcode.onmarked = function (type, result) { barcode.onmarked = function (type, result) {
if (type === plus.barcode.CODE128) { if (type === plus.barcode.CODE128 || type === plus.barcode.EAN13 || type === plus.barcode.EAN8) {
console.log(result,'result') console.log(result, 'result')
that.setBarcode(result) that.setBarcode(result)
barcode.close(); barcode.close();
that.$router.go(-1); that.$router.go(-1);
...@@ -71,7 +75,11 @@ ...@@ -71,7 +75,11 @@
barcode.start(); barcode.start();
}, },
_cancelScan() { _cancelScan() {
barcode.close(); try {
barcode.close();
}catch (e) {
//
}
this.$router.go(-1) this.$router.go(-1)
}, },
// _scanPicture() { // _scanPicture() {
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
label="位置" label="位置"
placeholder="位置" placeholder="位置"
:rules="[{ required: true, message: '请填写位置'}]" :rules="[{ required: true, message: '请填写位置'}]"
right-icon="add-o"
@click-right-icon="_locSelect"
></van-field> ></van-field>
<van-field <van-field
v-model="formObj.humidity" v-model="formObj.humidity"
...@@ -51,13 +53,18 @@ ...@@ -51,13 +53,18 @@
@cancel="showDatePicker = false" @cancel="showDatePicker = false"
></van-datetime-picker> ></van-datetime-picker>
</van-popup> </van-popup>
<SelectLoc ref="loc" @on-result-change="_locResult"></SelectLoc>
</div> </div>
</template> </template>
<script> <script>
import {envMonitor} from '../../api' import {envMonitor} from '../../api'
import SelectLoc from './components/SelectLoc'
export default { export default {
components: {
SelectLoc
},
data() { data() {
return { return {
showDatePicker: false, showDatePicker: false,
...@@ -135,6 +142,12 @@ ...@@ -135,6 +142,12 @@
} }
this.showDatePicker = false this.showDatePicker = false
}, },
_locSelect() {
this.$refs.loc._open()
},
_locResult(data) {
this.$set(this.formObj, 'location', data)
}
} }
} }
</script> </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="位置" :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}}</div>
</div>
</div>
</div>
</van-popup>
</template>
<script>
import {envMonitor} 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.location = this.key
}
return obj
},
_getData: async function () {
let result = await envMonitor.locList(this._searchParams())
this.resultList = result
},
_tapResult(item) {
this.$emit('on-result-change', item)
this.showPicker = false
},
}
}
</script>
<style scoped>
</style>
...@@ -16,27 +16,53 @@ ...@@ -16,27 +16,53 @@
</div> </div>
<div class="bottom-btn"> <div class="bottom-btn">
<van-button square block type="default" @click="_back">取消</van-button> <van-button square block type="default" @click="_back">取消</van-button>
<van-button square block type="info" @click="_saveNext">保存并下一个</van-button> <van-button square block type="info" @click="_save" v-if="id">保存</van-button>
<van-button square block type="info" @click="_saveNext" v-else>保存并下一个</van-button>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {mapMutations} from "vuex"; import {mapMutations} from "vuex";
// import {envMonitor} from '../../api'
export default { export default {
name: "SamplingCodeAdd", name: "SamplingCodeAdd",
data() { data() {
return { return {
code: '' code: '',
id: ''
} }
}, },
mounted() { mounted() {
this.code = this.$store.state.barcode this.code = this.$store.state.barcode
this.setBarcode() this.setBarcode()
this._open()
}, },
methods: { methods: {
...mapMutations(["setBarcode"]), ...mapMutations(["setBarcode"]),
_open() {
if (this.$route.query.id) {//编辑
this.id = this.$route.query.id
this._getData()
} else {
this.id = ''
}
},
_getData: async function () {
// let result = await envMonitor.getById(this.id)
// if (result) {
// for (let key in this.formObj) {
// if (result[key]) {
// if (key === 'monitorDate') {
// this.formObj[key] = this.$dateformat(result[key], 'yyyy-mm-dd')
// } else {
// this.formObj[key] = result[key]
// }
// }
// }
// }
},
_scan() { _scan() {
this.$router.push('/scan_bar') this.$router.push('/scan_bar')
}, },
......
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