haoxuan
2023-10-11 a1a6630f2eabfc78a379b5808b1bf7231a084d0b
src/components/ProcessModel.vue
@@ -31,9 +31,10 @@
                   <div class="item-l-bng">
                      <img src="../../public/process-model.png" />
                   </div>
                   <div class="item-r" @click="processDetailsClick(item)">
                      <div class="item-r-t font_weight">{{ item.procedure }}</div>
                      <div class="item-r-b">当前工艺编号:{{ item.number }}</div>
                   <div class="item-r" @click="processDetailsClick(item,index)">
                      <div class="item-r-t font_weight">{{ item.number }}</div>
                      <div class="item-r-b">产品:{{ item.product }}</div>
                      <div class="item-r-b">工序:{{ item.procedure }}</div>
                    </div>
                    <div class="tip-r" v-if="item.isUpdate">
                      <img src="../../public/process-tip.png" />
@@ -59,7 +60,7 @@
      </div>
      <div slot="footer" class="dialog-footer tac" style="overflow: hidden">
        
            <el-button
            <el-button v-if="isPage"
                      type="primary"
                      size="mini"
                      :disabled="top"
@@ -70,7 +71,7 @@
                      上一页</el-button
                    >
          
          <el-button
          <el-button v-if="isPage"
                      type="primary"
                      size="mini"
                      :disabled="bottom"
@@ -86,7 +87,8 @@
        ref="processDetails"
        :processObj="processObj"
        :listData="listData"
        @renew="getProcessModelList"
        :activeIndex='activeIndex'
        @updateProcess="updateProcess"
      />
    </div>
    
@@ -122,6 +124,10 @@
      total:0,
      top:false,
      bottom:false,
      index:null,
      isPage:false,
      isRenew:false,
      activeIndex:'',
    };
  },
  mounted() {
@@ -129,12 +135,14 @@
  },
  watch: {
    islook(){
      this.pageObj.page=1
      this.getProcessModelList()
    },
  },
  methods: {
    processDetailsClick(item){
    processDetailsClick(item,index){
      this.processObj=item;
      this.index=index;
      this.$refs.processDetails.islook=true;
    },
    closeClick() {
@@ -145,20 +153,21 @@
      if (
        Object.keys(this.listData).length > 0
      ) {
          this.islook = true;
          this.pageObj.page=1
          this.getProcessModelList()
          this.islook = true;
      } else {
        this.islook = false;
      }
    },
    getProcessModelList(){
    getProcessModelList(number){
      if( Object.keys(this.listData).length > 0){
        if(this.listData.Procedure.ID&&this.listData.number){
          processModelList({
            procedureId: this.listData.Procedure.ID,
            page: this.pageObj.page,
            pageSize:this.pageObj.pageSize,
            number:this.listData.number
            number:number?number:this.listData.number
          }).then(res=>{
            if(res.data){
              this.processList=res.data?res.data:[];
@@ -169,9 +178,11 @@
            }
            this.total=res.total?res.total:0;
            if(this.total<=6){
              this.isPage=false;
              this.top=true;
              this.bottom=true;
            }else{
              this.isPage=true;
              let pageTotal=Math.ceil(Number(this.total)/6)
              if(this.pageObj.page<pageTotal){
               
@@ -190,19 +201,37 @@
        }
      }
    },
    renew(){
      this.processObj.paramsMap=this.processObj.newParamsMap
      this.processObj.number=this.processObj.newNumber
      this.processObj.isUpdate=false
      this.isRenew=true;
      this.$emit('updateGet',this.processObj.newNumber)
      this.getProcessModelList(this.processObj.newNumber)
    },
    updateProcess(item,index){
      this.processObj=item;
      this.activeIndex=index;
      if (this.isLoading[index]) {
        return true;
      }
      this.isLoading[index]=true;
      this.$refs.processDetails.isLoading=true;
      updateProcessParams({procedureId:this.listData.Procedure.ID}).then(res=>{
        if(res.code==200){
          this.isLoading[index]=false;
          this.$refs.processDetails.isLoading=false;
          this.$message.success('更新成功!')
          this.getProcessModelList()
          this.renew();
        }else{
          this.isLoading[index]=false;
          this.$refs.processDetails.isLoading=false;
          this.$refs.processDetails.isUpdate=1;
        }
      })
      setTimeout(()=>{
        this.isLoading[index]=false;
        this.$refs.processDetails.isLoading=false;
      },50000)
    },
    onSubmitTop() {
@@ -215,6 +244,9 @@
    },
    shutdown() {
      this.islook = false;
      if(this.isRenew){
        this.$emit('updateGet',this.processObj.newNumber,true)
      }
    },
  },
};
@@ -409,7 +441,7 @@
      width:calc(100% - 20px);
      .title-item{
        width:calc(50%  - 30px);
        height:77px;
        height:92px;
        padding:23px 10px 10px;
        background:#31478f;
        border-radius: 8px;
@@ -432,7 +464,7 @@
        .item-r{
          width:calc(100% - 60px);
          float:left;
          line-height:25px;
          line-height:22px;
          color:#fff;
          font-size:15px;
          cursor:pointer;