From e3a9edfa7a5fe7be708eaf84ea534bbde700d1e0 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期六, 07 十月 2023 12:00:12 +0800
Subject: [PATCH] #
---
pages/common/data-list/dataDetail.vue | 80 +++++++++++++++++++++++---
pages/api/addMat.js | 5 +
pages/component/demo.vue | 24 ++++++-
components/z-data-list/z-data-list.vue | 42 +++++++++++--
README.md | 6 ++
5 files changed, 133 insertions(+), 24 deletions(-)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..99d85a0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+# 涓壃WMS鎵嬫寔缁堢
+
+`addMat` item鍙傛暟
+key: 鍚嶇О
+value: 鍊�
+type: 鍊肩被鍨� - input - number-box
\ No newline at end of file
diff --git a/components/z-data-list/z-data-list.vue b/components/z-data-list/z-data-list.vue
index 4ec90a0..c4bb67a 100644
--- a/components/z-data-list/z-data-list.vue
+++ b/components/z-data-list/z-data-list.vue
@@ -3,17 +3,20 @@
<view class="main">
<view class="main-left" >
<view class="main-list" v-for="it in dataList" style="width: 100%;">
- <view style="flex: 1;padding-left: 8rpx;">{{it.key}}</view>
+ <view class="left-key">{{it.key}}</view>
<view>:</view>
- <view style="flex: 3;padding-left: 8rpx;">{{it.value}}</view>
+ <view class="left-val">
+ <text class="val-text" style="">{{it.value}}</text>
+ </view>
</view>
</view>
- <view class="main-right" @click="goDetail">
- <view class="list-options">
- <view class="list-number">1</view>
- <uni-icons class="opt-icon" type="right" size="20" color="#707070"></uni-icons>
+ <uni-badge class="main-right uni-badge-left-margin" :text="index" absolute="rightTop" size="small" type="primary">
+ <view @click="goDetail">
+ <view class="list-options">
+ <uni-icons class="opt-icon" type="right" size="20" color="#707070"></uni-icons>
+ </view>
</view>
- </view>
+ </uni-badge>
</view>
</view>
</template>
@@ -55,6 +58,10 @@
default() {
return {}
}
+ },
+ index: {
+ type: Number,
+ default: 2
}
}
}
@@ -78,16 +85,20 @@
flex-direction: column;
padding-top: 8rpx;
padding-bottom: 8rpx;
+ color: #444;
+ font-size: 14px;
}
.main-right {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
+ border-left: 1px solid #ffffff;
}
.main-list {
display: flex;
align-items: center;
+ margin: 8rpx 0;
}
.list-options {
display: flex;
@@ -101,4 +112,21 @@
.opt-icon {
display: flex;
}
+ .left-key {
+ width: 130rpx;
+ padding-right: 8rpx;
+ text-align: end;
+ font-weight: 700;
+ }
+ .left-val {
+ flex: 1;
+ padding-left: 8rpx;
+ color: #666;
+ }
+ .val-text {
+ background-color: blue;
+ padding: 2px 4px;
+ border-radius: 8rpx;
+ color: white;
+ }
</style>
\ No newline at end of file
diff --git a/pages/api/addMat.js b/pages/api/addMat.js
index 25bbed2..bc6b2ff 100644
--- a/pages/api/addMat.js
+++ b/pages/api/addMat.js
@@ -1,7 +1,7 @@
async function addMat() {
let that = this,item = {};
var ress = await uni.request({
- url: 'http://127.0.0.1:8089/bfwms/mat/auth',
+ url: 'http://192.168.4.188:8089/bfwms/mat/auth',
data: {matnr: '3CPPJ.B.GMB.LZ.QBY4-10/15P316LLZ'},
}).then((result)=> {
let mat = result.data.data
@@ -9,7 +9,8 @@
{key: '鍟嗗搧鐮�',value: mat.matnr},
{key: '鍟嗗搧鍚嶇О',value: mat.maktx},
{key: '瑙勬牸',value: mat.specs},
- {key: '鏁伴噺',value: 100},
+ {key: '鎵瑰彿',value: '',type: 'input'},
+ {key: '鏁伴噺',value: 0,type: 'number-box'},
]
},(res)=>{
console.log(res);
diff --git a/pages/common/data-list/dataDetail.vue b/pages/common/data-list/dataDetail.vue
index 4feda4c..fd981f1 100644
--- a/pages/common/data-list/dataDetail.vue
+++ b/pages/common/data-list/dataDetail.vue
@@ -1,20 +1,48 @@
<template>
+ <view>
+ <view class="main" v-for="(it,i) in dataList" :key="i">
+ <view class="main-left">{{it.key}}</view>
+
+ <view class="main-right"
+ v-show="!it.type">
+ {{it.value}}
+ </view>
+
+ <input class="main-right"
+ v-show="it.type == 'input'"
+ type="text"
+ v-model="it.value"
+ >
+ <view class="main-right dis-center" v-show="it.type == 'number-box'" @click="numChange(i)">
+ <uni-number-box
+ color="#747474"
+ v-show="it.type == 'number-box'"
+ :value="it.value"
+ :max="99999999"
+ :step='1'
+ @change="changeValue"
+ />
+ </view>
+
+ </view>
+
+ <button @click="back">back</button>
+ </view>
</template>
<script>
export default {
data() {
return {
- mat: {
- matnr: null,
- maktx: null,
- specs: null,
- batch: null,
- orderNo: null,
- anfme: 0,
- },
+ dataList: [
+ {key: '鍟嗗搧缂栫爜',value: 'fbr3dasdasd242fbr3dasdasd242fbr3dasdasd242fbr3dasdasd242fbr2'},
+ {key: '鎵瑰彿',value: '20231006',type: 'input'},
+ {key: '鏁伴噺',value: 200,type: 'number-box'},
+ ],
baseIP:'',
basePORT:'',
+ index: 0,
+ val: 0,
}
},
onLoad(option) {
@@ -28,14 +56,20 @@
// 鐩戝惉acceptDataFromOpenerPage浜嬩欢锛岃幏鍙栦笂涓�椤甸潰閫氳繃eventChannel浼犻�佸埌褰撳墠椤甸潰鐨勬暟鎹�
eventChannel.on('mat', function(data) {
- console.log(data);
+ that.dataList = data.data
})
},
methods: {
+ numChange(i) {
+ this.dataList[i].value = this.val
+ },
+ changeValue(value) {
+ this.val = value
+ },
back() {
- this.getOpenerEventChannel().emit('matList', {data: this.mat});
+ this.getOpenerEventChannel().emit('dataList', {data: this.dataList});
uni.navigateBack({
})
@@ -44,5 +78,29 @@
}
</script>
-<style>
+<style scoped>
+ .main {
+ display: flex;
+ border-bottom: 1px solid #333;
+ min-height: 70rpx;
+ align-items: center;
+ margin-left: 8px;
+ padding: 8rpx;
+ }
+ .main-left {
+ width: 140rpx;
+ text-align: right;
+ }
+ .main-right {
+ flex: 1;
+ background-color: aquamarine;
+ margin-left: 8rpx;
+ display: flex;
+ flex-wrap: wrap;
+ /* word-wrap: break-word; */
+ word-break: break-all;
+ }
+ .dis-center {
+ justify-content: center;
+ }
</style>
\ No newline at end of file
diff --git a/pages/component/demo.vue b/pages/component/demo.vue
index 55b9159..650200f 100644
--- a/pages/component/demo.vue
+++ b/pages/component/demo.vue
@@ -17,7 +17,14 @@
<hr>
- <z-data-list class="data-list" v-for="it in zDataList" @goDetail='goDetail(it.item)' :list="it" ></z-data-list>
+ <z-data-list class="data-list"
+ v-for="(it,i) in zDataList"
+ :key="i"
+ :list="it"
+ :index="i+1"
+ @goDetail='goDetail(it.detl)'
+
+ ></z-data-list>
<button @click="add">add</button>
@@ -39,7 +46,17 @@
{name: 'yyy',desc: '鎵樼洏鐮�',val: '2',lenCheck: 8,focus: false},
{name: 'aaa',desc: '鐗╂枡鐮�',btn: true,btnName: '鎻愬彇',placeholder: '',val: '1',focus: false}
],
- zDataList: [],
+ zDataList: [
+ {
+ detl: [
+ {key: '鍟嗗搧鐮�',value: 'ccc'},
+ {key: '鍟嗗搧鍚嶇О',value: 'ccc'},
+ {key: '瑙勬牸',value: 'ccc'},
+ {key: '鎵瑰彿',value: '16',type: 'input'},
+ {key: '鏁伴噺',value: 0,type: 'number-box'},
+ ]
+ }
+ ],
}
},
methods: {
@@ -70,7 +87,6 @@
},
goDetail(param) {
- console.log(param);
uni.navigateTo({
url: '/pages/common/data-list/dataDetail',
// 浼�
@@ -81,7 +97,7 @@
},
// 鎺�
events: {
- matList: function(data) {
+ dataList: function(data) {
console.log(data);
},
},
--
Gitblit v1.9.1