quanyawei
2023-10-20 d8b41fff43a2cee6a8f714ffa807623b15803786
pages/actionChange/components/basicInfor.vue
New file
@@ -0,0 +1,234 @@
<template>
   <view class="">
      <!-- 基础信息 -->
      <view class="workOrderDetail">
         <view class="headerCont">
            <p class="title">基本信息</p>
            <p>单号:{{ basicInfor.allocationNum }}</p>
         </view>
         <u-line color="#bbb" />
         <view>
            <view class="mainContent">
               <p class="rowTip">
                  <view class="rowTipContenet">
                     <view class="wholeLine">
                        <text class="rowTipContenetLabel">责任主体:</text>
                        <text class="rowTipContenetAll">
                           {{ unitName }}
                        </text>
                     </view>
                  </view>
                  <view class="rowTipContenet">
                     <view class="wholeLine">
                        <text class="rowTipContenetLabel">污染分类:</text>
                        <text class="rowTipContenetAll">
                           {{ polluteType }}
                        </text>
                     </view>
                  </view>
               </p>
               <p class="rowTip">
                  <view class="rowTipContenet">
                     <view class="wholeLine">
                        <text class="rowTipContenetLabel">排查方式:</text>
                        <!-- this.dictObj.investigationEnum[val.investigationType] -->
                        <text class="rowTipContenetAll">
                           {{ dictObj.investigationEnum[basicInfor.investigationType] ||'' }}
                        </text>
                     </view>
                  </view>
                  <view class="rowTipContenet">
                     <view class="wholeLine">
                        <text class="rowTipContenetLabel">整改类型:</text>
                        <text class="rowTipContenetAll">
                           {{ dictObj.changeEnum[basicInfor.changeType] ||'' }}
                        </text>
                     </view>
                  </view>
               </p>
               <p class="rowTip">
                  <view class="rowTipContenet">
                     <view class="wholeLine">
                        <text class="rowTipContenetLabel">上报单位:</text>
                        <text class="rowTipContenetAll">
                           {{ escalationUnitName }}
                        </text>
                     </view>
                  </view>
                  <view class="rowTipContenet">
                     <view class="wholeLine">
                        <text class="rowTipContenetLabel">上报人:</text>
                        <text class="rowTipContenetAll">{{ basicInfor.escalationName ||'' }}</text>
                     </view>
                  </view>
               </p>
               <p class="rowTip">
                  <view class="wholeLine">
                     <text class="rowTipContenetLabel">上报时间:</text>
                     <text class="rowTipContenetAll">{{ basicInfor.escalationTime ||'' }}</text>
                  </view>
               </p>
               <p class="rowTip">
                  <view class="wholeLine">
                     <text class="rowTipContenetLabel">污染位置:</text>
                     <text class="rowTipContenetAll">{{ basicInfor.pollutePosition ||'' }}</text>
                  </view>
               </p>
               <p class="rowTip">
                  <view class="wholeLine">
                     <text class="rowTipContenetLabel">相关附件:</text>
                     <text v-if="fileList.length>0" class="rowTipContenetAll">
                        <cl-upload
                           v-model="fileList"
                           :action="`''`"
                           :add="false"
                           cloud-type="other"
                           :remove="false"
                        />
                     </text>
                  </view>
               </p>
            </view>
         </view>
      </view>
   </view>
</template>
<script>
export default {
   props: {
    basicInfor: {
     type: Object,
     default: ()=> {}
      },
   },
   data() {
      return {
         polluteList: this.$storage.getJson('polluteList'),
         unitList: this.$storage.getJson('unitList'),
         dictObj: this.$storage.getJson('dictObj'),
         fileList: [],
         baseUrl: this.$storage.get('baseUrl'),
      }
   },
   computed: {
      unitName(){
         let data ={}
         if(this.basicInfor.unitId){
            data=this.unitList&& this.unitList.find(
               (a)=> parseInt(a.unitId) === this.basicInfor.unitId
            )
            console.log('nnnnnn', this.unitList)
            console.log('nnnnnn', this.basicInfor.unitId)
         }
         return data.unitName || ''
      },
      escalationUnitName(){
         let data ={}
         if(this.basicInfor.unitId){
            data=this.unitList&& this.unitList.find(
               (a)=> parseInt(a.unitId) === this.basicInfor.escalationUnitId
            )
            console.log('nnnnnn', this.unitList)
            console.log('nnnnnn', this.basicInfor.unitId)
         }
         return data.unitName || ''
      },
      polluteType(){
         let data ={}
         if(this.basicInfor.polluteType){
            data=this.polluteList.find(
               (a)=> parseInt(a.dataKey) === this.basicInfor.polluteType
            )
         }
         return data.dataValue ||''
      }
   },
   watch: {
      basicInfor: {
         handler: function(newValue, oldValue) {
            // 响应数据变化
            this.basicInfor=newValue
         },
         deep: true
      }
   },
   onLoad: function (option) {
      //option为object类型,会序列化上个页面传递的参数
      console.log(option) //打印出上个页面传递的参数。
   },
   mounted() {
      if(this.basicInfor.fileBaseList&&this.basicInfor.fileBaseList.length>0){
         this.basicInfor.fileBaseList.forEach(item=> {
            this.baseUrl='http://120.26.43.34:8081/api/'
            let name = item.fileType === 1 ? 'name.png' : ''
            this.fileList.push(`${this.baseUrl}/file/preview/${item.fileId}?${name}`) // 原图
            this.fileList.push('http://120.26.43.34:8081/api//file/preview/145?name.png') // 原图
         })
         console.log('this.fileList', this.basicInfor.fileBaseList)
         console.log('this.fileList', this.fileList)
      }
   },
   methods: {},
}
</script>
<style scoped lang="scss">
/deep/.u-line {
  margin: 19.23rpx 0px !important;
}
.workOrderDetail {
  border: 1px solid #bbb;
  border-radius: 5px;
  min-height: 288.46rpx;
  margin: 19.23rpx;
  padding: 19.23rpx;
  color: #101010;
  font-weight: 700;
  font-size: 26.92rpx;
  .headerCont {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
  }
  .mainContent {
    margin-bottom: 10px;
    font-weight: 500;
    .rowTip {
      display: flex;
      padding: 8px 0;
      border-bottom: 1px dashed #bbb;
      .wholeLine {
        display: flex;
      width: 100%;
        align-items: center;
        .rowTipContenetLabel {
          min-width: 125rpx;
        }
      .rowTipContenetAll{
         width: calc(100% - 125rpx);
      }
      }
      .rowTipContenet {
        width: 50%;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        .butsName {
          display: inline-block;
          margin-left: 19.23rpx;
          color: #1990ff;
        }
      }
    }
    .rowTipContenet_right {
      text-align: right !important;
    }
  }
}
</style>