Mr.Shi
2023-09-05 3878c57a2bd710295931303ea85439a596838dfd
minipro_standard/pages_adjust/components/Warehouse.vue
@@ -5,57 +5,106 @@
      </view>
      <view class="content">
         <view class="content_search">
            <u-search :showAction="false" placeholder="请输入仓库名称" v-model="keyword"></u-search>
            <u-search :showAction="false" placeholder="请输入仓库名称" v-model="form.name" @search="searchInput"></u-search>
         </view>
         <div class="content_total">共{{total}}条数据</div>
         <view class="content_list">
            <u-list @scrolltolower="scrolltolower">
               <u-list-item v-for="(item, index) in indexList" :key="index">
                  <div class="content_list_item" @click="getVal(item)">
         <div class="content_total">共{{form.total}}条数据</div>
         <scroll-view
         class="content_list"
         @scrolltolower="getList"
         scroll-y>
            <!-- <u-list @scrolltolower="scrolltolower"> -->
               <!-- <u-list-item > -->
                  <div class="content_list_item"v-for="(item, index) in list" :key="index" @click="getVal(item)">
                     <div class="content_list_item_name">
                        <span style="color: #03AF76;">[DTFHNE]</span>
                        <!-- <span style="color: #03AF76;" v-if="item.tmodel.label == 'APPLIANCE_ONTEST'">[{{ item.tmodel.code }}]</span>
                        <span style="color: #03AF76;" v-if="item.tmodel.label == 'APPLIANCE_ONTEST'">[{{ item.tmodel.code }}]</span>
                        <span style="color: #305ED5;" v-if="item.tmodel.label == 'APPLIANCE_MIX'">[{{ item.tmodel.code }}]</span>
                        <span style="color: #F5A400;" v-if="item.tmodel.label == 'APPLIANCE_OFFTEST'">[{{ item.tmodel.code }}]</span> -->
                        <!-- <span style="color: red;" v-if="item.tmodel.label == 'APPLIANCE_USELESS'">[{{ item.tmodel.code }}]</span> -->
                        <span style="color: #F5A400;" v-if="item.tmodel.label == 'APPLIANCE_OFFTEST'">[{{ item.tmodel.code }}]</span>
                        <span style="color: red;" v-if="item.tmodel.label == 'APPLIANCE_USELESS'">[{{ item.tmodel.code }}]</span>
                        <span>{{item.name}}</span>
                     </div>
                  </div>
               </u-list-item>
            </u-list>
         </view>
            <!--    </u-list-item>
            </u-list> -->
         </scroll-view>
      </view>
   </u-popup>
</template>
<script>
   import { warehouseList } from '@/util/api/WorkOrderAPI'
   export default {
      props: {
         show: Boolean
         show: Boolean,
         systemDicDataId: {
            type: String,
            default: ''
         }
      },
      data() {
         return {
            keyword: '',
            total: 0,
            indexList: []
            form: {
               capacity: 50,
               page: 0,
               total: 0,
               name: '',
            },
            list: [],
            loading: false,
            finished: false,
            refreshing: false
         };
      },
      methods: {
         searchInput() {
            this.form.page = 0
            this.finished = false
            this.list = []
            this.getList()
         },
         getVal(item) {
            this.$emit('value', item)
         },
         open() {
            this.indexList = []
            this.loadmore()
            this.form.page = 0
            this.finished = false
            this.list = []
            this.getList()
         },
         scrolltolower() {
            this.loadmore()
            this.getList()
         },
         loadmore() {
            for (let i = 0; i < 20; i++) {
               this.indexList.push({
                  id: i,
                  name: `仓库${i}`
         getList() {
            if (!this.finished) {
               this.loading = true;
               this.form.page = this.form.page += 1
               warehouseList({
                  capacity: this.form.capacity,
                  page: this.form.page,
                  model: {
                     systemDicDataId: this.systemDicDataId,
                     name: this.form.name,
                     status: 1
                  }
               }).then(res => {
                  if (this.refreshing) {
                     this.list = []
                     this.refreshing = false;
                  }
                  this.loading = false;
                  if (res.code === 200 && res.data.records && res.data.records.length !== 0) {
                     this.form.total = res.data.total
                     this.list.push(...res.data.records)
                  } else {
                     this.finished = true;
                  }
               }).catch(err => {
                  this.loading = false;
                  this.finished = true;
                  if (this.refreshing) {
                     this.list = []
                     this.refreshing = false;
                  }
               })
            }
         },