From d8e6f395fea1419c73f6b6f0a2ddd75eac3eed84 Mon Sep 17 00:00:00 2001
From: whycq <913841844@qq.com>
Date: 星期五, 01 十二月 2023 08:15:17 +0800
Subject: [PATCH] #
---
pages/api/common/common.js | 7
components/z-input/z-input.vue | 15 +
pages/api/addMat.js | 5
pages/project/project.json | 71 +++++-
components/x-input/x-input.vue | 215 +++++++++++++++++++
components/z-list/z-list.vue | 148 +++++++++++++
pages/project/pakin/pakin.vue | 93 ++++++--
components/zzz/zzz.vue | 70 ++++++
8 files changed, 580 insertions(+), 44 deletions(-)
diff --git a/components/x-input/x-input.vue b/components/x-input/x-input.vue
new file mode 100644
index 0000000..c0c49de
--- /dev/null
+++ b/components/x-input/x-input.vue
@@ -0,0 +1,215 @@
+<template>
+ <view>
+ <view class="main">
+ <view class="inner1">{{attribute.lable}}</view>
+ <view class="put inner2">
+ <uni-icons class="p-icon"
+ type="scan"
+ size="16"
+ color="#a6a6a6"
+ @click="scanCode"
+ v-show="attribute.scanCode"
+ >
+ </uni-icons>
+ <input class="p-input"
+ type="text"
+ :placeholder="placeholder"
+ v-model="zzz"
+ :focus="focusData"
+ @input="change"
+ >
+
+ <uni-icons class="p-icon"
+ type="closeempty"
+ size="16"
+ color="#b9b9b9"
+ v-show="data.length"
+ @click="clear">
+
+ </uni-icons>
+ </view>
+ <view class="inner3" v-show="btn">
+ <button class="m-btn" size="mini" @click="clickBtn">{{btnName}}</button>
+ </view>
+ </view>
+ </view>
+</template>
+
+<script>
+ export default {
+ name:"x-input",
+ data() {
+ return {
+ data:'',
+ focusData: false
+ };
+ },
+ props: {
+ attribute: {
+ type: Object,
+ default() {
+ return {}
+ }
+ },
+ index: {
+ type: Number,
+ default: 0
+ },
+ lable: {
+ type: String,
+ default: ''
+ },
+ name: {
+ type: String,
+ default: ''
+ },
+ btn: {
+ type: Boolean,
+ default: false
+ },
+ btnName: {
+ type: String,
+ default: 'button'
+ },
+ placeholder: {
+ type: String,
+ default: '鎵爜 / 褰曞叆'
+ },
+ value: {
+ type: [String,Number],
+ default: ''
+ },
+ v: {
+ type: [String,Number],
+ default: ''
+ },
+ lenCheck: {
+ type: [Number],
+ default: null
+ },
+ focus: {
+ type: Boolean,
+ default: false
+ }
+ },
+ watch: {
+ data(val) {
+ // if (!this.lenCheck) {
+ // this.$emit('input',val)
+ // return
+ // }
+ // if (val.length != this.lenCheck) {
+ // setTimeout(()=>{
+ // this.data = ''
+ // this.$emit('input','')
+ // },10)
+ // } else {
+ // this.$emit('input',val)
+ // }
+ },
+ value(val) {
+ this.data = val
+ },
+ focus(f) {
+ this.focusData = !f
+ setTimeout(()=>{
+ this.focusData = f
+ },10)
+ },
+ zzz(val) {
+ // this.v = val
+ }
+
+ },
+ created() {
+ this.data = this.value
+ this.focusData = this.focus
+ },
+ methods: {
+ change() {
+ let _this = this
+ console.log(`鍊兼敼鍙樹簡: ${this.zzz}`);
+ // if (this.data.length > 8) {
+ // this.data = 66666
+ // }
+ this.$emit('change')
+ },
+ clear() {
+ this.data = ''
+ console.log(this.attribute);
+ },
+ clickBtn() {
+ this.$emit('clickBtn');
+ },
+ inputVal() {
+ this.$emit('inputVal',[this.data,this.name]);
+ },
+ scanCode() {
+ let _this = this
+ uni.scanCode({
+ onlyFromCamera: true,
+ success(res) {
+ _this.$parent.scanCode(res.result)
+ _this.data = res.result
+ console.log('鎵埌浜�');
+ console.log(res);
+ }
+ })
+ }
+ }
+ }
+</script>
+
+<style scoped>
+ .main {
+ display: flex;
+ align-items: center;
+ min-height: 50px;
+ background-color: #fff;
+ }
+ .put {
+ display: flex;
+ flex-shrink: 0;
+ }
+
+ .inner1 {
+ width: 55px;
+ padding-left: 8px;
+ color: #606164;
+ font-weight: 900;
+ font-family:'Helvetica Neue';
+ }
+ .inner2 {
+ background-color: #f8f8f8;
+ flex: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 5px;
+ margin-right: 32rpx;
+ color: #606266;
+ }
+ .p-input {
+ flex:1;
+ padding: 4px;
+ }
+ .p-icon {
+ margin-left: 4px;
+ margin-right: 4px;
+ }
+ .inner3 {
+ width: 90px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ .m-btn {
+ background-color: #00aeec;
+ color: #FFF;
+ }
+ .m-btn:active {
+ background-color: #55bbff;
+ color: #FFF;
+ }
+
+</style>
\ No newline at end of file
diff --git a/components/z-input/z-input.vue b/components/z-input/z-input.vue
index c401bd5..cabe92b 100644
--- a/components/z-input/z-input.vue
+++ b/components/z-input/z-input.vue
@@ -7,6 +7,7 @@
type="scan"
size="16"
color="#a6a6a6"
+ @click="scanCode"
>
</uni-icons>
<input class="p-input"
@@ -87,7 +88,7 @@
setTimeout(()=>{
this.data = ''
this.$emit('input','')
- },10)
+ },0)
} else {
this.$emit('input',val)
}
@@ -115,6 +116,18 @@
},
inputVal() {
this.$emit('inputVal',[this.data,this.name]);
+ },
+ scanCode() {
+ let _this = this
+ uni.scanCode({
+ onlyFromCamera: true,
+ success(res) {
+ _this.$parent.scanCode(res.result)
+ _this.data = res.result
+ console.log('鎵埌浜�');
+ console.log(res);
+ }
+ })
}
}
}
diff --git a/components/z-list/z-list.vue b/components/z-list/z-list.vue
new file mode 100644
index 0000000..4770ee3
--- /dev/null
+++ b/components/z-list/z-list.vue
@@ -0,0 +1,148 @@
+<template>
+ <view >
+ <view class="main">
+ <view class="main-left" >
+ <view class="main-list" v-for="it in list" style="width: 100%;">
+ <view class="left-key">{{it.key}}</view>
+ <view>:</view>
+ <view class="left-val">
+ <text :class="it.valText">{{it.value}}</text>
+ </view>
+ </view>
+ </view>
+ <uni-badge
+ class="main-right uni-badge-left-margin"
+ :text="index"
+ absolute="rightTop"
+ size="small"
+ type="primary"
+ >
+ <view style="height: 100%;display: flex;align-items: center;" @click="goDetail">
+ <view class="list-options">
+ <uni-icons class="opt-icon" type="right" size="20" color="#b9b9b9"></uni-icons>
+ </view>
+ </view>
+ </uni-badge>
+ </view>
+ </view>
+</template>
+
+<script>
+ export default {
+ name:"z-list",
+ data() {
+ return {
+ dataList: [
+ {key: '鍟嗗搧缂栫爜',value: 'fbr3242'},
+ {key: '鎵瑰彿',value: '20231006'},
+ {key: '鏁伴噺',value: '200'},
+ {key: '鍟嗗搧缂栫爜',value: 'fbr3242'},
+ {key: '鎵瑰彿',value: '20231006'},
+ {key: '鏁伴噺',value: '200'}
+ ],
+ detailList: [],
+ dataKey: {},
+ valText: 'val-text'
+ };
+ },
+ methods: {
+ goDetail() {
+ this.$emit('goDetail');
+ }
+ },
+ created() {
+ // this.dataList = this.list.detl
+ },
+ props: {
+ list: {
+ type: Array,
+ default() {
+ return {}
+ }
+ },
+ keyName: {
+ type: Object,
+ default() {
+ return {}
+ }
+ },
+ index: {
+ type: Number,
+ default: 2
+ }
+ }
+ }
+</script>
+<!-- align-items: stretch -->
+<!-- 鐗涢�硷紒锛侊紒 -->
+<!-- 璁剧疆align-items涓簊tretch锛屼娇瀛愬厓绱犲~鍏呭瀭鐩存柟鍚戠殑鍙敤楂樺害锛屽疄鐜伴珮搴︾浉绛夌殑鏁堟灉銆� -->
+<style scoped>
+ .main {
+ position: relative;
+ min-height: 35px;
+ background-color: #f5f5f5;
+ display: flex;
+ align-items: stretch;
+ margin: 8px 12px 8px 12px;
+ border-radius: 8px;
+ }
+ .main-left {
+ flex: 7;
+ display: flex;
+ flex-direction: column;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ color: #606164;
+ font-size: 14px;
+ }
+ .main-right {
+ width: 30px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-left: 1px solid #ffffff;
+ }
+ .main-right:active {
+ background-color: #e3e5e7;
+ color: #FFF;
+ }
+ .main-list {
+ display: flex;
+ align-items: center;
+ margin: 2px 0;
+ }
+ .list-options {
+ display: flex;
+ flex-direction: column;
+ }
+ .list-number {
+ position: absolute;
+ right: 10px;
+ top: 5px;
+ }
+ .opt-icon {
+ display: flex;
+ }
+ .left-key {
+ width: 65px;
+ padding-right: 4px;
+ text-align: end;
+ font-weight: 700;
+ }
+ .left-val {
+ flex: 1;
+ padding-left: 4px;
+ color: #606266;
+ }
+ .val-text {
+ background-color: #00aeec;
+ padding: 2px 4px;
+ border-radius: 4px;
+ color: #FFF;
+ }
+ .val-num {
+ font-weight: 900;
+ color: #d19a66;
+ font-size: 16px;
+ }
+</style>
\ No newline at end of file
diff --git a/components/zzz/zzz.vue b/components/zzz/zzz.vue
new file mode 100644
index 0000000..c38658a
--- /dev/null
+++ b/components/zzz/zzz.vue
@@ -0,0 +1,70 @@
+<template>
+ <view>
+ <uni-icons class="p-icon"
+ type="scan"
+ size="16"
+ color="#a6a6a6"
+ @click="scanCode"
+ >
+ </uni-icons>
+ <input v-model="data" @input="change" >
+ </view>
+</template>
+
+<script>
+ export default {
+ name:"zzz",
+ data() {
+ return {
+ data: ''
+ };
+ },
+ props: {
+ value: {
+ type: String,
+ default: ""
+ },
+ },
+ watch: {
+ data(val){
+ if (val.length != 8) {
+ setTimeout(()=>{
+ this.data = ''
+ // this.value = '9999'
+ this.$emit('input','')
+ },0)
+ } else {
+ this.$emit('input',val)
+ }
+ },
+ value(val) {
+ this.data = val
+ }
+ },
+ created() {
+ this.data = this.value
+ },
+ methods: {
+ change() {
+ this.$emit('change1')
+ },
+ scanCode() {
+ let _this = this
+ uni.scanCode({
+ onlyFromCamera: true,
+ success(res) {
+ _this.$parent.scanCode(res.result)
+ _this.data = res.result
+ _this.value = res.result
+ console.log('鎵埌浜�');
+ console.log(res);
+ }
+ })
+ }
+ }
+ }
+</script>
+
+<style>
+
+</style>
\ No newline at end of file
diff --git a/pages/api/addMat.js b/pages/api/addMat.js
index b573c20..e2fcae4 100644
--- a/pages/api/addMat.js
+++ b/pages/api/addMat.js
@@ -1,5 +1,8 @@
let network = uni.getStorageSync('Network')
-let baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
+let baseUrl = ''
+if (network) {
+ baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
+}
async function addMat(matnr) {
let that = this,item = {};
var ress = await uni.request({
diff --git a/pages/api/common/common.js b/pages/api/common/common.js
index 67a13a7..5b4a46d 100644
--- a/pages/api/common/common.js
+++ b/pages/api/common/common.js
@@ -1,8 +1,11 @@
import md5 from '@/static/js/md5.js'
let network = uni.getStorageSync('Network')
-let baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
-
+let baseUrl = ''
+if (network) {
+ baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
+}
+console.log(network);
async function onLogin(user) {
let _this = this,
item = {};
diff --git a/pages/project/pakin/pakin.vue b/pages/project/pakin/pakin.vue
index 163d36c..9661dbf 100644
--- a/pages/project/pakin/pakin.vue
+++ b/pages/project/pakin/pakin.vue
@@ -1,22 +1,46 @@
<template>
<view>
<view class="head">
- <z-input v-for="it in input"
- :desc="it.title"
- :name="it.name"
- :btn="it.btn"
- :btn-name="it.btnName"
- v-model="it.val"
- :index="it.id"
- :lenCheck="it.lenCheck"
- :focus="it.focus"
- @inputVal='input2'
- ></z-input>
+ <z-input :desc="input1.title"
+ :name="input1.name"
+ :btn="input1.btn"
+ :btn-name="input1.btnName"
+ v-model="barcode"
+ :index="input1.id"
+ :lenCheck="input1.lenCheck"
+ :focus="input1.focus"
+ @inputVal='input3'
+ />
+ <z-input
+ :desc="input2.title"
+ :name="input2.name"
+ :btn="input2.btn"
+ :btn-name="input2.btnName"
+ v-model="matnr"
+ :index="input2.id"
+ :lenCheck="input2.lenCheck"
+ :focus="input2.focus"
+ @inputVal='input3'
+ />
</view>
+ <!-- 鍩烘湰灞炴�х粦瀹� -->
+ <!-- 鍏夋爣澶嶄綅 -->
+ <!-- 闀垮害鍒ゆ柇 -->
+
<u-sticky >
- <view class="sticky">鍟嗗搧鍒楄〃</view>
+ <view class="sticky">
+ <view class="flex1">寮�鍚敭鐩�</view>
+ <view class="flex1">鍟嗗搧鍒楄〃</view>
+ <view class="flex1"></view>
+ </view>
</u-sticky>
+ <view>barcode:{{barcode}}</view>
+ <!-- <zzz v-model="barcode" @change1='change' @input="inputz"></zzz> -->
+ <view>matnr:{{matnr}}</view>
+ <!-- <zzz v-model="matnr" @change1='change' @input="inputz"></zzz> -->
+
+
<z-data-list class="data-list"
v-for="(it,i) in zDataList"
@@ -24,20 +48,14 @@
:lable="lable"
:fields="it"
:index="i+1"
- @goDetail='goDetail(it.detl,i)'
+ @goDetail='goDetail(it,i)'
></z-data-list>
-
-
-
-
-
-
<!-- 鍨珮 -->
<view style="height: 100rpx;"></view>
<view class="z-floor">
<view class="z-default">閲嶇疆</view>
- <view class="z-primary">缁勬墭</view>
+ <view class="z-primary" @click="comb">缁勬墭</view>
</view>
</view>
@@ -49,22 +67,36 @@
export default {
data() {
return {
- zDataList: [
- // {matnr: 'A1001',maktx: '1鍙风墿鏂�',count: 99},
- // {matnr: 'A1002',maktx: '2鍙风墿鏂�',count: 77},
- // {matnr: 'A1002',maktx: '2鍙风墿鏂�',count: 77}
- ],
+ zDataList: [ ],
+ barcode: '80009991',
+ matnr: '',
+ inputCode: '鎵樼洏鐮�',
}
},
onShow() {
// console.log(this.page);
},
computed: mapState({
- input: state => state.project.menu[0].page.input,
+ input1: state => state.project.menu[0].page.input[0],
+ input2: state => state.project.menu[0].page.input[1],
+ xInput: state => state.project.menu[0].page.input1,
lable: state => state.project.menu[0].page.lable
}),
methods: {
- input2(arr) {
+ inputz() {
+ // console.log(this.barcode);
+ console.log(this.matnr);
+ },
+ change() {
+ // console.log(this.barcode);
+ // console.log(this.matnr);
+
+ },
+ scanCode(data) {
+ // console.log(data);
+
+ },
+ input3(arr) {
if(arr[1] == 'matnr') {
this.getMat(arr[0])
}
@@ -95,6 +127,10 @@
}
},
})
+ },
+ comb() {
+ console.log(this.barcode);
+ console.log(this.matnr);
}
}
}
@@ -113,5 +149,8 @@
align-items: center;
justify-content: center;
}
+ .flex1 {
+ flex: 1
+ }
</style>
diff --git a/pages/project/project.json b/pages/project/project.json
index 3ace745..68bec41 100644
--- a/pages/project/project.json
+++ b/pages/project/project.json
@@ -1,8 +1,7 @@
{
- "title":"骞虫箹鍝佷笂鏂板彂鐜�",
+ "title": "骞虫箹鍝佷笂鏂板彂鐜�",
"name": "ps",
- "menu": [
- {
+ "menu": [{
"title": "缁勬墭鍏ュ簱",
"name": "pakin",
"url": "/pakin/pakin",
@@ -11,18 +10,64 @@
"width": "90%",
"sort": 1,
"page": {
- "input": [
- {"id":1,"name": "barcode","title": "鎵樼洏鐮�","val": "2","lenCheck": 8,"focus": true},
- {"id":2,"name": "matnr","title": "鐗╂枡鐮�","val": "2","btn": true,"btnName": "鎻愬彇","focus": true}
+ "input": [{
+ "id": 1,
+ "name": "barcode",
+ "title": "鎵樼洏鐮�",
+ "val": "",
+ "lenCheck": 8,
+ "focus": true
+ },
+ {
+ "id": 2,
+ "name": "matnr",
+ "title": "鐗╂枡鐮�",
+ "val": "",
+ "btn": true,
+ "btnName": "鎻愬彇",
+ "focus": false
+ }
],
- "lable": [
- {"label": "鍟嗗搧鐮�","attribute":"matnr","value": "fbr3242","valText": "val-text"},
- {"label": "鍟嗗搧鍚嶇О","attribute":"maktx","value": "fbr3242"},
- {"label": "瑙勬牸","attribute":"specs","value": "fbr3242"},
- {"label": "鎵瑰彿","attribute":"batch","value": "fbr3242"},
- {"label": "鏁伴噺","attribute":"count","value": 9999,"type": "number-box","valText": "val-num"}
+ "input1": {
+ "attribute": "barcode",
+ "lable": "鎵樼洏鐮�",
+ "length": 8,
+ "scanCode": true
+ },
+ "input2": {
+ "attribute": "matnr",
+ "lable": "鐗╂枡鐮�"
+ },
+ "lable": [{
+ "label": "鍟嗗搧鐮�",
+ "attribute": "matnr",
+ "value": "fbr3242",
+ "valText": "val-text"
+ },
+ {
+ "label": "鍟嗗搧鍚嶇О",
+ "attribute": "maktx",
+ "value": "fbr3242"
+ },
+ {
+ "label": "瑙勬牸",
+ "attribute": "specs",
+ "value": "fbr3242"
+ },
+ {
+ "label": "鎵瑰彿",
+ "attribute": "batch",
+ "value": "fbr3242"
+ },
+ {
+ "label": "鏁伴噺",
+ "attribute": "count",
+ "value": 9999,
+ "type": "number-box",
+ "valText": "val-num"
+ }
]
-
+
}
},
{
--
Gitblit v1.9.1