whycq0520
2022-03-26 3693de3a743f774c81727a35f4b5ee9d28013a16
pages/basics/publish.vue
@@ -1,6 +1,21 @@
<template>
   <view>
      <view>
      <view class="margin-top">
         <view class="app-list">
            <view class="app-list-cell">
               <view class="app-list-cell-left">上架货位</view>
               <view class="app-list-cell-db">
                  <picker mode="multiSelector" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray">
                     <view class="app-input">{{multiArray[0][multiIndex[0]]}}
                                       ,{{multiArray[1][multiIndex[1]]}}
                                       ,{{multiArray[2][multiIndex[2]]}}</view>
                  </picker>
               </view>
            </view>
         </view>
      </view>
      <view class="margin-top">
         <uni-table border stripe type="selection" emptyText="没有更多数据">
            <uni-tr>
               <uni-th align="center">数量</uni-th>
@@ -50,8 +65,8 @@
      <view>
         <!-- 显示表单弹窗 -->
         <uni-popup ref="showNodeSelect" type="dialog">
            <uni-popup-dialog ref="inputClose" mode="input" title="选择入库货位" >
            <uni-popup-dialog ref="inputClose" mode="input" title="选择入库货位" @confirm="aabbcc()">
            </uni-popup-dialog>
         </uni-popup>
      </view>
@@ -68,13 +83,45 @@
            rowNum:'',
            msgType: '',
            messageText: '',
            selectData: "",
            index: 0,
            multiArray: [
               ['请选择'],
               ['请选择'],
               ['请选择']
            ],
            multiIndex: [0, 0, 0],
            date: getDate({
               format: true
            }),
            startDate:getDate('start'),
            endDate:getDate('end'),
            sum: '',
            nodeSel: '',
         }
      },
      onLoad() {
      },
      mounted(){
         const UIP = uni.getStorageSync('UIP');
         this.baseIP = UIP;
         const UPORT = uni.getStorageSync('UPORT');
         this.basePORT = UPORT
         let that = this
         uni.request({
            url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/node/tree/auth",
            header: { 'token':uni.getStorageSync('token') },
            data: {},
            method:'POST',
            success(res) {
               var res = res.data
               if (res.code === 200 ) {
                  that.selectData = res.data
                  that.multiArray[0] = [res.data[0].title,res.data[0].children[0].title]
               }
            }
         })
      },
      methods: {
         // 弹出层
@@ -154,21 +201,199 @@
                   return;
               }
            }
            this.$refs.showNodeSelect.open()
            uni.request({
               url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/work/stock/pakin",
               header: { 'token':uni.getStorageSync('token') },
               data: {},
               method:'POST',
               success(res) {
                  console.log(res)
               }
            })
         },
         bindMultiPickerColumnChange: function(e) {
            var selectData = this.selectData
            var selectData2 = this.selectData[0].children[0].children[0].children
            var   selectData3 = this.selectData[0].children[0].children[1].children
            this.multiIndex[e.detail.column] = e.detail.value
            switch (e.detail.column) {
               case 0: //拖动第1列
                  switch (this.multiIndex[0]) {
                     case 0:
                        this.multiArray[1] = [selectData[0].title]
                        this.multiArray[2] = [selectData[0].title]
                        break
                     case 1:
                        this.multiArray[1] = [selectData[0].children[0].children[0].title,
                                          selectData[0].children[0].children[1].title]
                        this.multiArray[2] = [selectData2[0].title,
                                             selectData2[1].title,
                                             selectData2[2].title,
                                             selectData2[3].title,
                                             selectData2[4].title,
                                             selectData2[5].title,
                                             selectData2[6].title,
                                             selectData2[7].title,
                                             selectData2[8].title,
                                             selectData2[9].title,
                                             selectData2[10].title,
                                             selectData2[11].title,
                                             selectData2[12].title,
                                             selectData2[13].title,
                                             selectData2[14].title,
                                             selectData2[15].title, ]
                        break
                  }
                  this.multiIndex.splice(1, 1, 0)
                  this.multiIndex.splice(2, 1, 0)
                  break
               case 1: //拖动第2列
                  switch (this.multiIndex[0]) { //判断第一列是什么
                     case 0:
                        switch (this.multiIndex[1]) {
                           case 0:
                              break
                           case 1:
                              this.multiArray[2] = ['东京','北海道']
                              break
                        }
                        break
                     case 1:
                        switch (this.multiIndex[1]) {
                           case 0:
                              this.multiArray[2] = [selectData2[0].title,
                                             selectData2[1].title,
                                             selectData2[2].title,
                                             selectData2[3].title,
                                             selectData2[4].title,
                                             selectData2[5].title,
                                             selectData2[6].title,
                                             selectData2[7].title,
                                             selectData2[8].title,
                                             selectData2[9].title,
                                             selectData2[10].title,
                                             selectData2[11].title,
                                             selectData2[12].title,
                                             selectData2[13].title,
                                             selectData2[14].title,
                                             selectData2[15].title, ]
                              break
                           case 1:
                              this.multiArray[2] = [selectData3[0].title,
                                             selectData3[1].title,
                                             selectData3[2].title,
                                             selectData3[3].title,
                                             selectData3[4].title,
                                             selectData3[5].title,
                                             selectData3[6].title,
                                             selectData3[7].title,
                                             selectData3[8].title,
                                             selectData3[9].title,
                                             selectData3[10].title,
                                             selectData3[11].title,
                                             selectData3[12].title,
                                             selectData3[13].title,
                                             selectData3[14].title,
                                             selectData3[15].title, ]
                              break
                        }
                        break
                  }
                  this.multiIndex.splice(2, 1, 0)
                  break
            }
            this.$forceUpdate()
            var num1 = this.multiIndex[0]
            var num2 = this.multiIndex[1]
            var num3 = this.multiIndex[2]
            this.sum = num1 + "-" + num2 + "-" + num3
            console.log(this.sum)
            this.changeNum(this.sum)
         },
         changeNum() {
            console.log(this.sum)
            switch (this.sum) {
               case 0-0-0:
                  console.log('ycq')
                  this.nodeSel = 1
                  break;
               case 1-0-0:
                  console.log('ycq')
                  this.nodeSel = 1
                  break;
            }
            console.log(this.nodeSel)
         },
         aabbcc(e) {
            console.log(e)
         }
      }
   }
</script>
<style>
   .app-list {
      background-color: #ffffff;
      position: relative;
      width: 100%;
      display: flex;
      flex-direction: column;
   }
   .app-list:after {
      position: absolute;
      z-index: 10;
      right: 0;
      bottom: 0;
      left: 0;
      height: 1px;
      content: '';
      -webkit-transform: scaleY(.5);
      transform: scaleY(.5);
      background-color: #c8c7cc;
   }
   .app-list::before {
      position: absolute;
      z-index: 10;
      right: 0;
      top: 0;
      left: 0;
      height: 1px;
      content: '';
      -webkit-transform: scaleY(.5);
      transform: scaleY(.5);
      background-color: #c8c7cc;
   }
   .app-list-cell {
      position: relative;
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
   }
   .app-list-cell-left {
       white-space: nowrap;
      font-size:28rpx;
      padding: 0 30rpx;
   }
   .app-list-cell-db,
   .app-list-cell-right {
      flex: 1;
   }
   .app-input {
      height: 80rpx;
      padding: 15rpx 25rpx;
      line-height:50rpx;
      font-size:28rpx;
      background:#FFF;
      flex: 1;
   }
   .app-list-cell::after {
      position: absolute;
      z-index: 3;
      right: 0;
      bottom: 0;
      left: 30rpx;
      height: 1px;
      content: '';
      -webkit-transform: scaleY(.5);
      transform: scaleY(.5);
      background-color: #c8c7cc;
   }
</style>