wk
2024-09-09 71ba67906896248aa2df5e70756b997fad9a9033
subPages/addDailyPlan/addDailyPlan.vue
@@ -9,10 +9,15 @@
                  当前选择订单
               </view>
               <view class="selected-info_text">
                  <niceui-data-select-input v-model="deptId"
                  <uni-combox :candidates="customerNameList" placeholder="请选择订单"
                   labelKey="text"
                   valueKey="value"
                   ref='combox'
                   v-model="deptId" @input="(e)=>deptChange(e)"></uni-combox>
                  <!-- <niceui-data-select-input v-model="deptId"
                     :localdata="customerNameList"
                     placeholder="请选择订单"
                     @change="deptChange"></niceui-data-select-input>
                     @change="deptChange"></niceui-data-select-input> -->
               </view>
            </view>
         </view>
@@ -45,6 +50,8 @@
         </view>
             <view class="table">
         <uni-table border stripe 
         @selection-change="selectionChange"
          type="selection"
         emptyText="暂无更多数据">
               <uni-tr>
                   <uni-th align="center">产品名称</uni-th>
@@ -96,7 +103,7 @@
                     v-for="item in customerNameList"
                     @click="selectCustomer(item)">
                     <view class="item-image">
                        <image src="https://mx.jzeg.cn:9096/appimg/image/banner/address.png"
                        <image src="https://wrzs.czjlchem.com:9090/appimg/image/banner/address.png"
                           mode="widthFix"
                           style="width: 18px;"></image>
                     </view>
@@ -132,6 +139,7 @@
         return {
            selfDeliverShow: false,
            deptId: '',
            checkList:[],
            deptName: '',
            deptList: [],
            productName: '',
@@ -152,18 +160,18 @@
      },
      computed: {
         abledBuild() {
            return !this.subDataList.length || !this.sendDate || !this.value
            return !this.subDataList.length || !this.sendDate || !this.value || !this.checkList.length
         }
      },
      methods: {
            //查询订单
            getDingdan(){
                    this.$reqGet('getAppOrderList',{orderType:'外销'})
                    this.$reqGet('getAppOrderList',{code:this.deptId})
               .then(res => {
                  uni.hideLoading()
                  if (res.code == 0) {
                     this.customerNameList = res.data.map(item=>{
                        item.text = (item.productNames ? item.productNames : item.productName) + '-' + item.orderCode;
                        item.text =  item.orderCode;
                        item.value = item.id;
                        return item;
                     });
@@ -180,10 +188,34 @@
               })
            },
         deptChange(e) {
            console.log(e,'eee');
            this.subDataList = this.customerNameList.filter(item=>item.id === e).length ?
            this.customerNameList.filter(item=>item.id === e)[0].tmOrderList  : [];
            ;
            console.log(e,this.$refs.combox,'eee');
            this.$reqGet('getAppOrderList',{code:this.$refs.combox.inputVal})
               .then(res => {
                  uni.hideLoading()
                  if (res.code == 0) {
                     this.customerNameList = res.data.map(item=>{
                        item.text =  item.orderCode;
                        item.value = item.id;
                        return item;
                     });
                     if(this.customerNameList.length === 1){
                        this.deptId = this.customerNameList[0].value; //选择当前
                        // if(this.deptId){
                        //    this.deptChange(this.deptId);
                        // }
                     }else{
                        this.deptId = '';
                     }
                     if(this.deptId){
                  this.subDataList = this.customerNameList.filter(item=>item.id === e).length ?
                     this.customerNameList.filter(item=>item.id === e)[0].tmOrderList  : [];
                     }else{
                        this.subDataList = [];
                     }
                  }
               })
            
         },
         confirmBuild() {
@@ -192,6 +224,7 @@
              carNum:this.value,
              sendDate:this.sendDate,
              sendSign:0,
              itemIds:this.checkList.join(",") + ','
            }
            this.buildLoading = true
            this.$reqPost('addDeliveryPlan', form, 'json').then(res => {
@@ -209,6 +242,17 @@
            }).catch(e => {
               this.buildLoading = false
            })
         },
         selectionChange(item){
            //选择 某个产品
            this.checkList = [];
            console.log(item,'items')
             if(item.detail.index.length){
               item.detail.index.forEach((v) => {
               this.checkList.push(this.subDataList[v].id)
              })
               console.log(this.checkList,'checkList')
             }
         }
      },
   }
@@ -247,6 +291,8 @@
   .main {
      width: 100%;
      color: #232323;
      overflow: auto;
      height: 80vh;
      .product-info {
         width: 96%;