guoshilong
2022-10-08 830ce15ad9894bdfd442ecd3e8051bd0cd79836b
pages/repairsorder/list.vue
@@ -29,11 +29,12 @@
                     </view>
                  </view>
                  <view class="onve-right">
                     <u-button class='greens' size="mini" v-if="current == 0">开始维修
                     <u-button class='greens' size="mini" v-if="current == 0" @click="startRepair(item)">开始维修
                     </u-button>
                     <u-button class='greens' size="mini" v-if="current == 1">完成维修
                     <u-button class='greens' size="mini" v-if="current == 1" @click="finishRepair(item)">完成维修
                     </u-button>
                     <u-button class='o-r-down' plain type="error" size="mini" v-if="current != 2" @click="materialRequire">材料申请
                     </u-button>
                  </view>
               </view>
@@ -47,7 +48,7 @@
<script>
   import {
      getList
      getList,update
   } from "@/api/repairsorder/repairsorder";
   export default {
      data() {
@@ -76,6 +77,9 @@
            repairsorderList: null
         }
      },
      onShow() {
         this.getList()
      },
      created() {
         this.getList()
      },
@@ -92,6 +96,11 @@
            getList(this.page.currentPage, this.page.pageSize, this.query).then(res => {
               const data = res.data;
               this.page.total = data.total;
               data.records.forEach(e=>{
                  if(e.picUrls.length==0){
                     e.picUrls = null
                  }
               })
               this.repairsorderList = data.records;
            })
         },
@@ -110,8 +119,49 @@
            uni.navigateTo({
               url: '/pages/repairsorder/detail?id=' + id
            })
         },
         //开始维修
         startRepair(item){
            uni.showModal({
               title:"提示",
               content:"是否开始维修?",
               success:(res)=> {
                  if(res.confirm){
                     item.state = '2'
                     update(item).then(res=>{
                        if(res.code == 200){
                           this.page.currentPage = 1
                           this.getList()
                        }
                     })
                  }
               }
            })
         },
         //维修完成
         finishRepair(item){
            uni.showModal({
               title:"提示",
               content:"是否结束任务?",
               success:(res)=> {
                  if(res.confirm){
                     item.state = '3'
                     update(item).then(res=>{
                        if(res.code == 200){
                           this.page.currentPage = 1
                           this.getList()
                        }
                     })
                  }
               }
            })
         },
         //维修材料申请
         materialRequire(){
            uni.navigateTo({
               url: '/pages/inventory/materialRequire'
            })
         }
      }
   }
</script>