#
whycq
2023-10-13 368591db5ce828a835c63f327dce6ccfbd159dc4
pages/component/demo.vue
@@ -17,11 +17,27 @@
      
      <hr>
      
      <z-data-list></z-data-list>
      <z-data-list class="data-list"
         v-for="(it,i) in zDataList"
         :key="i"
         :list="it.detl"
         :index="i+1"
         @goDetail='goDetail(it.detl,i)'
      ></z-data-list>
      <button @click="add">add</button>
      <hr>
      <!-- 垫高 -->
      <view style="height: 100rpx;"></view>
   </view>
</template>
<script>
   import addMat, { isEmpty } from '../api/addMat.js'
   export default {
      data() {
         return {
@@ -31,9 +47,57 @@
               {name: 'aaa',desc: '物料码',btn: true,btnName: '提取',placeholder: '',val: '1',focus: false}
            ],
            zDataList: [
               {name: 'asd',orderNo: 'CK123',barcode: 'bar321'}
            ]
               {
                  detl: [
                     {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                     {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                     {key: '规格',value: '700*699*80'},
                     {key: '批号',value: '20231007204944',type: 'input'},
                     {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                     {key: '序号',value: 1},
                  ]
               },
               {
                  detl: [
                     {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                     {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                     {key: '规格',value: '700*699*80'},
                     {key: '批号',value: '20231007204944',type: 'input'},
                     {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                     {key: '序号',value: 2},
                  ]
               },
               {
                  detl: [
                     {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                     {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                     {key: '规格',value: '700*699*80'},
                     {key: '批号',value: '20231007204944',type: 'input'},
                     {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                     {key: '序号',value: 3},
                  ]
               },
               {
                  detl: [
                     {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                     {key: '商品名称',value: '尼龙头(灰白)5.2x25'},
                     {key: '规格',value: '700*699*80'},
                     {key: '批号',value: '20231007204944',type: 'input'},
                     {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                     {key: '序号',value: 4},
                  ]
               },
               {
                  detl: [
                     {key: '商品码',value: 'LSH90152025',valText: 'val-text'},
                     {key: '商品名称',value: '尼龙头(灰白)'},
                     {key: '规格',value: '700*699*80'},
                     {key: '批号',value: '20231007204944',type: 'input'},
                     {key: '数量',value: 951326478,type: 'number-box',valText: 'val-num'},
                     {key: '序号',value: 5},
                  ]
               }
            ],
         }
      },
      methods: {
@@ -41,8 +105,11 @@
         },
         ccc() {
         },
         aaa() {
         async add() {
            let mat = await addMat.addMat()
            if (!addMat.isEmpty(mat)) {
               this.zDataList.push(mat)
            }
         },
         focus() {
            if (this.zInputList[0].focus) {
@@ -59,6 +126,28 @@
               this.zInputList[2].focus = false
            }
            
         },
         goDetail(param,index) {
            let _this = this
            uni.navigateTo({
               url: '/pages/common/data-list/dataDetail',
               // 传
               success: function(data) {
                  data.eventChannel.emit('param', {
                     param: param,
                     index: index
                  })
               },
               // 接
               events: {
                  dataList: function(data) {
                     console.log(data);
                  },
                  del: function(data) {
                     _this.zDataList.splice(data.data,1)
                  }
               },
            })
         }
      }
      
@@ -66,4 +155,14 @@
</script>
<style>
   .data-list {
   }
   .data-list:last-child {
      margin-bottom: 100px;
   }
   hr {
      margin-top: 10px;
      margin-bottom: 10px;
   }
</style>