Commit 17564213 by zhuxiaomei

分类查询 抽样条码前端

parent da821d55
NODE_ENV=development
VUE_APP_BASE_URL=http://api.dev.patzn.com:7000
VUE_APP_BASE_URL=http://192.168.0.39:7000
......@@ -5,6 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve --mode development",
"build": "vue-cli-service build --mode production",
"buildDev": "vue-cli-service build --mode development",
"lint": "vue-cli-service lint"
},
"dependencies": {
......
......@@ -13,6 +13,13 @@
<script src="<%= BASE_URL %>js/back.js"></script>
</head>
<body>
<script src="<%= BASE_URL %>js/vconsole.min.js"></script>
<script>
window.vConsole = new window.VConsole();
console.log('Hello world');
</script>
<!--<noscript>-->
<!--<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.-->
<!--Please enable it to continue.</strong>-->
......
<template>
<div>
<van-field
v-model="code"
label="条码"
right-icon="scan"
placeholder="请输入或扫码条码"
@click-right-icon="_scan"
></van-field>
</div>
</template>
<script>
import {mapMutations} from "vuex";
export default {
name: "class",
data() {
return {
code: ''
}
},
mounted() {
this.code = this.$store.state.barcode
this.setBarcode()
},
methods: {
...mapMutations(["setBarcode"]),
_scan() {
this.$router.push('/scan_bar')
}
}
}
</script>
<style scoped>
</style>
......@@ -17,9 +17,9 @@
</template>
<script>
// import indexImg10 from '../assets/index/10.png'
import indexImg10 from '../assets/index/10.png'
import indexImg1 from '../assets/index/1.png'
// import indexImg11 from '../assets/index/11.png'
import indexImg11 from '../assets/index/11.png'
import FooterBar from '@/components/FooterBar.vue'
export default {
......@@ -30,9 +30,9 @@
data() {
return {
menuList: [
// {img: indexImg10, title: '抽样任务', uri: '/sampling_task/sampling_task'},
{img: indexImg1, title: '温湿度登记', uri: '/register/register'},
// {img: indexImg11, title: '历史抽样单', uri: '/history_sampling/sampling_list'},
{img: indexImg10, title: '分类查询', uri: '/class'},
{img: indexImg11, title: '抽样条码', uri: '/sampling_code/sampling_code'},
],
}
},
......
<template>
<customer-navBar-layout>
<template #navBar>
<van-nav-bar title="扫码"
left-arrow
@click-left="_cancelScan"></van-nav-bar>
</template>
<template #content>
<div id="bcid">
<div style="height:40%"></div>
</div>
<div class="bottom-btn">
<van-button block type="default" @click="_cancelScan">取消</van-button>
</div>
</template>
</customer-navBar-layout>
</template>
<style scoped>
#bcid {
width: 100%;
height: calc(100% - 42px);
text-align: center;
}
</style>
<script>
import {mapMutations} from "vuex";
var barcode = null;//扫码对象
export default {
data() {
return {
num: '',
}
},
mounted() {
this._open()
//返回键操作
mui.init({
beforeback: function () {
barcode.close();
return true;
}
});
},
methods: {
...mapMutations(["setBarcode"]),
_open() {
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) {
console.log(result,'result')
that.setBarcode(result)
barcode.close();
that.$router.go(-1);
} else {
that.$toast('扫描失败!')
barcode.close();
that.$router.go(-1);
}
};
plus.webview.currentWebview().append(barcode);
}
barcode.start();
},
_cancelScan() {
barcode.close();
this.$router.go(-1)
},
// _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>
......@@ -62,16 +62,16 @@
<van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_del([item.id])"></van-button>
<!--<van-button square type="default" text="操作日志" class="swipe-cell-btn"-->
<!--@click="_records(item)"></van-button>-->
<!--@click="_records(item)"></van-button>-->
</template>
</van-swipe-cell>
</van-checkbox-group>
</van-list>
</van-pull-refresh>
</div>
<div class="bottom-btn bottom-btn-two" v-if="showCheck">
<van-button square @click="_checkAll">{{checkAll?'取消全选':'全选'}}</van-button>
<van-button square type="danger" @click="_del(checkListValue)">删除</van-button>
<div class="bottom-btn" v-if="showCheck">
<van-button square block @click="_checkAll">{{checkAll?'取消全选':'全选'}}</van-button>
<van-button square block type="danger" @click="_del(checkListValue)">删除</van-button>
</div>
</template>
</customer-navBar-layout>
......
<template>
<customer-navBar-layout>
<template #navBar>
<van-nav-bar
:title="$route.meta.title"
right-text="添加"
left-arrow
@click-left="_back"
@click-right="_add"
></van-nav-bar>
</template>
<template #content>
<search-bar label="抽样单号" ref="searchBar"></search-bar>
<div class="layout-cont-s">
<!--下拉刷新 https://vant-contrib.gitee.io/vant/#/zh-CN/pull-refresh-->
<van-pull-refresh v-model="refreshing" @refresh="_refresh">
<!--上拉加载 https://vant-contrib.gitee.io/vant/#/zh-CN/list-->
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="_load">
<van-swipe-cell v-for="item in resultList" :key="item.id">
<div class="result-item" @click="_tapItem(item)">
<div>抽样单号:{{item.humidity}}</div>
</div>
<template #right>
<van-button square type="info" text="编辑" class="swipe-cell-btn"
@click="_edit(item)"></van-button>
<van-button square type="danger" text="删除" class="swipe-cell-btn"
@click="_del([item.id])"></van-button>
</template>
</van-swipe-cell>
</van-list>
</van-pull-refresh>
</div>
</template>
</customer-navBar-layout>
</template>
<script>
import {envMonitor} from '../../api'
export default {
name: "SamplingCode",
data() {
return {
key: '',
resultList: [],
page: 1,
rows: 10,
refreshing: false,//刷新中...
loading: false,//加载中...
finished: false,//没有更多数据
}
},
mounted() {
this._getData()
},
methods: {
//简单查询 清空高级查询条件 赋值简单查询数据
_search(value) {
this.key = value
this._refresh()
},
_searchParams() {
let data = {
page: this.page,
rows: this.rows,
};
if (this.key) {
data.location = this.key
}
return this.$serializeForm(data)
},
_getData: async function () {
let result = await envMonitor.page(this._searchParams())
this.resultList = [...(this.page === 1 ? [] : this.resultList), ...result.records]
this.refreshing = false
this.loading = false
if (this.resultList.length === result.total) {
this.finished = true
}
},
_refresh() {
this.page = 1;
this._getData()
},
_load() {
this.page = this.page + 1;
this._getData()
},
_back() {
this.$router.go(-1)
},
_add() {
this.$router.push({path: '/sampling_code/sampling_code_add', query: {title: '抽样条码-添加'}})
},
_edit({id}) {
this.$router.push({path: '/sampling_code/sampling_code_add', query: {id: id, title: '抽样条码-编辑'}})
},
_del(ids) {
if (ids.length === 0) {
this.$toast('请至少选择一条数据!')
} else {
this._delOk(ids)
}
},
_delOk: async function (ids) {
let result = await envMonitor.deleteByIds(ids)
if (result) {
this.$toast('操作成功!')
this._refresh()
}
},
}
}
</script>
<style scoped>
</style>
<template>
<div>
<div class="layout-cont-btn">
<van-field
v-model="code"
label="条码"
right-icon="scan"
placeholder="请输入或扫码条码"
@click-right-icon="_scan"
></van-field>
<van-field
v-model="code"
label="抽样单编号"
placeholder="请输入抽样单号"
></van-field>
</div>
<div class="bottom-btn">
<van-button square block type="default" @click="_back">取消</van-button>
<van-button square block type="info" @click="_saveNext">保存并下一个</van-button>
</div>
</div>
</template>
<script>
import {mapMutations} from "vuex";
export default {
name: "SamplingCodeAdd",
data() {
return {
code: ''
}
},
mounted() {
this.code = this.$store.state.barcode
this.setBarcode()
},
methods: {
...mapMutations(["setBarcode"]),
_scan() {
this.$router.push('/scan_bar')
},
_back() {
this.$router.go(-1);
},
_saveNext() {
}
}
}
</script>
<style scoped>
</style>
......@@ -2,8 +2,12 @@ import Index from '@/page/Index'
import Home from '@/page/Home'
import Login from '@/page/Login'
import ForgetPwd from '@/page/ForgetPwd'
import Class from '@/page/Class'
import ScanBar from '@/page/ScanBar'
import RegisterRoutes from './register-routes'
import MineRoutes from './mine-routes'
import SamplingCodeRoutes from './sampling-code-routes'
import DebugComponent from '@/components/DebugComponent.vue'
......@@ -27,24 +31,39 @@ export default [
name: "forgetPwd",
component: ForgetPwd,
meta: {title: "找回密码", hideNavBar: true},
},{
}, {
path: "/debug",
name: "debug",
component: DebugComponent,
meta: {title: "调试组件页面", hideNavBar: true},
},
{
path: '/class',
name: 'class',
component: Class,
meta: {title: '分类查询'}
},{
path: '/scan_bar',
name: 'scan',
component: ScanBar,
meta: {title: '分类查询',hideNavBar: true}
},
],
}, {
path: '/mine',
component: Index,
children: MineRoutes,
mata: {title: '个人中心'}
},{
}, {
path: '/register',
component: Index,
children: RegisterRoutes,
mata: {title: '温湿度登记'}
}, {
path: '/sampling_code',
component: Index,
children: SamplingCodeRoutes,
mata: {title: '抽样条码'}
},
]
import SamplingCode from '@/page/sampling-code/SamplingCode.vue'
import SamplingCodeAdd from '@/page/sampling-code/SamplingCodeAdd.vue'
export default [
{path: 'sampling_code', component: SamplingCode, meta: {title: '抽样条码',hideNavBar: true}},
{path: 'sampling_code_add', component: SamplingCodeAdd, meta: {customerNavBarTitle: true}},
]
......@@ -5,11 +5,11 @@ Vue.use(Vuex)
const store = new Vuex.Store({
state: {
count: 0
barcode: ''
},
mutations: {
increment (state) {
state.count++
setBarcode(state, barcode) {
state.barcode = barcode
}
}
})
......
......@@ -90,12 +90,8 @@ html, body, #app, .main-content-con {
.bottom-btn {
width: 100%;
height: 44px;
}
.bottom-btn-two {
> button {
width: 50%
}
display: flex;
flex: 1;
}
.personal-cont {
......
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