uploadMaterial.vue 4.03 KB
<template>
  <div>
    <el-tabs class="tabs" v-model="activeName" @tab-click="handleClick">
      <el-tab-pane v-for="item in tabs" :key="item.name" :label="item.label" :name="item.name">
          <span slot="label" :class="[{noPassTab:noPass(item.name,'tab')}]"><span v-if="item.isRequire==1" class="required">*</span>{{item.label}}</span>
          <div v-if="curCode && activeName=='detail'" class="second-tabs">
            <template v-for="ele in detailImgList">
              <span :class="[{ active: curCode == ele.serviceItemCode },{'noPass':noPass(ele)}]" :key="ele.serviceItemCode" v-if="ele.checked" @click="changeSecondTab(ele)">{{ ele.serviceItemName }}</span>
            </template>
          </div>
          <span v-if="isWriteOff && curCode =='SC0002' && activeName=='detail'">无附件资料待上传</span>
          <img-list :isWriteOff="isWriteOff" :isCustomerCommit="isCustomerCommit" :curLossType="curLossType" :disabled="disabled" :id="id" :curRouteInfo="curRouteInfo" :curKey="activeName"  :curCode="curCode"  :list="attachmentList"></img-list>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script type="text/ecmascript-6">
import cameraUrl from '@/assets/camera.png'
import write_off from '@/assets/logo.png'
import url from '../../image/code.png'
import imgList from './imgList'
// import Card from './card.vue'
export default {
  name: 'uploadMaterial',
  props:{
    tabs:{
      type: Array
    },
    detailImgList:{
      type: Array
    },
    id: {
      type: Number
    },
    attachmentList:{
      type: Array
    },
    curCodefromParent:{
      type: String,
      default: ''
    },
    curRouteInfo: Object,
    disabled:{
      type: Boolean,
      default: false
    },
    curLossType:{
      type: Array,
      default:function(){
        return []
      }
    },
    isCustomerCommit:{
      type: Boolean,
      default: false
    },
    isWriteOff:{
      type: Boolean,
      default: false
    }
  },
  computed:{
    noPass(){
      return function(val, type){
        const target = this.attachmentList.find(item =>{
          if(type=='tab'){
            return (val == item.key && item?.imgObj?.auditStatus===0)
          }else{
            return (item.serviceItemCode == val.serviceItemCode && item?.imgObj?.auditStatus===0 && val.checked)
          }
        })
        return !!target
      }
    }
  },
  data() {
    return {
      url,
      cameraUrl,
      curCode: '',
      write_off,
      activeName: 'base'
    }
  },
  components: {
    imgList,
    // Card
  },
  mounted() {
    const target = this.detailImgList.find(item => item.checked)
    this.curCode = target?.serviceItemCode || ''
  },
  methods: {
    handleClick(){
      this.$emit('handleClick',this.activeName)
    },
    setTab(val){
      this.activeName = val
    },
    changeSecondTab(item){
      if(item) this.curCode = item.serviceItemCode
    },
    setActiveTab(){
      const target = this.detailImgList.find(item => item.checked)
      this.curCode = target?.serviceItemCode || ''
    }
  }
}
</script>
<style lang="scss" scoped>
/deep/ .el-tabs {
  .el-tabs__nav-wrap::after {
    height: 1px;
    background-color: #FFFFFF;
  }
  .el-tabs__item {
    height: 45px;
    font-size: 16px;
    font-weight: 500;
  }
}
.second-tabs {
  height: 36px;
  background: #f8f8f8;
  border-radius: 4px;
  display: flex;
  position: relative;
  align-items: center;
  padding: 2px;
  margin-bottom: 16px;
  span {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 14px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #5850ff;
  }
  .active {
    background-color: #fff;
  }
}
.transport-pic {
  font-size: 14px;
  color: #00a479;
  cursor: pointer;
}

.noPass,.noPassTab{
  position: relative;
  &::before{
    content: '';
    height: 6px;
    width: 6px;
    position: absolute;
    right: 11px;
    background-color: red;
    border-radius: 50%;
    top: 8px;
  }
}

.noPassTab{
  &::before{
    right: -6px;
    top: 0;
  }
}

.required {
  color: #f56c6c;
  margin-right: 4px;
}
</style>