Lou
2023-11-10 197f13dbcf007eac8dd9a307aae992df677ea8f6
subPackage/workbench/views/cscj.vue
@@ -5,7 +5,7 @@
            <box-title title="基础信息"></box-title>
         </view>
         <view class="item">
            <u-form-item @click="showPicker = true" class="form-item" labelWidth="100" label="楼栋:"
            <u-form-item v-if="!currentId" @click="showPicker = true" class="form-item" labelWidth="100" label="楼栋:"
               :required="isRequired" :disabled="isDisabled" prop="buildingCode">
               <u--input border="none" disabledColor="#ffffff" v-model="form.building" placeholder="请选择">
               </u--input>
@@ -94,8 +94,9 @@
         <lineItem :dataInfo="comprehensiveData.scene">
            <template v-slot:pic="{scope}">
               <view class="image" v-if="scope.value !== ''">
                  <u--image @click="imgPreview(scope.value)" width="200rpx" height="200rpx" :src="scope.value"></u--image>
               <view class="image" v-if="scope.value !== ''">
                  <u--image @click="imgPreview(scope.value)" width="200rpx" height="200rpx"
                     :src="scope.value"></u--image>
               </view>
            </template>
         </lineItem>
@@ -127,7 +128,7 @@
      <view class="bottom">
         <view class="btn">
            <u-button @click="submit" type="primary" text="提交"></u-button>
            <u-button @click="submit" type="primary" text="提交" v-if="!currentId"></u-button>
         </view>
      </view>
@@ -159,8 +160,14 @@
      getDoorplateAddressList
   } from "@/api/doorplateAddress/doorplateAddress";
   import {
      getPlaceDetail
   } from '@/api/place/place.js'
   import {
      add
   } from "@/api/place/place";
   import {
      format
   } from "echarts";
   export default {
      mixins: [uploadMixin],
      components: {
@@ -182,8 +189,8 @@
               buildingCode: "",
               label: "",
               remark: "",
               imageUrls: "",
               placeName: ""
               imageUrls: "",
               placeName: "",
            },
            rules: {
               'buildingCode': {
@@ -294,7 +301,6 @@
               ],
               scene: [{
                     label: "消防照片",
                     value: "",
                     useSlot: "pic",
                  },
                  {
@@ -326,8 +332,8 @@
            activeIds: [],
            showLabelList: [],
            stdId: "",
            houseCode: "",
            currentId: ""
         }
      },
      watch: {
@@ -340,6 +346,9 @@
            handler(newVal) {
               console.log(newVal)
            }
         },
         showLabelList(newVal) {
            console.log(newVal);
         }
      },
@@ -354,9 +363,13 @@
         styleIsolation: 'shared', // 解除样式隔离
      },
      onLoad(option) {
         this.stdId = option.stdId
         console.log(this.stdId, "----------")
         if (this.stdId) {
         const {
            houseCode,
            id
         } = option
         this.houseCode = houseCode
         this.currentId = id
         if (this.currentId || this.houseCode) {
            this.getBuildingDetail()
         }
@@ -368,48 +381,117 @@
      },
      methods: {
         getBuildingDetail(params = {}) {
            getDoorplateAddressDetail(Object.assign(params, {
               stdId: this.stdId
            })).then(res => {
               let data = res.data
               this.form.buildingCode = data.buildingCode
         // getBuildingDetail(params = {}) {
         //    getDoorplateAddressDetail(Object.assign(params, {
         //       stdId: this.stdId
         //    })).then(res => {
         //       let data = res.data
         //       this.form.buildingCode = data.buildingCode
               let buildingNameArr = [data.townStreetName, data.neiName, data.streetRuName, data.aoiName,
                  data.buildingName
         //       let buildingNameArr = [data.townStreetName, data.neiName, data.streetRuName, data.aoiName,
         //          data.buildingName
         //       ]
         //       let arr = buildingNameArr.filter(e => {
         //          return e != null || e != ''
         //       })
         //       // 赋值
         //       // this.form.placeName = data['placeName']
         //       Object.keys(this.form).forEach(key => {
         //          if (!data[key]) {
         //             this.form[key] = data.place[key]
         //          } else {
         //             this.form[key] = data[key]
         //          }
         //       })
         //       this.form.building = arr.join("")
         //       Object.keys(this.comprehensiveData).forEach(key => {
         //          this.comprehensiveData[key].forEach(item => {
         //             if (!data[item.name]) {
         //                item.value = data.place[item.name] || '未完善'
         //             } else {
         //                item.value = data[item.name] || '未完善'
         //             }
         //          })
         //          this.publicData[key].forEach(item => {
         //             if (!data[item.name]) {
         //                item.value = data.place[item.name] || '未完善'
         //             } else {
         //                item.value = data[item.name] || '未完善'
         //             }
         //          })
         //       })
         //    })
         // },
         getBuildingDetail(params = {}) {
            let idorCodeParams = {}
            if (this.houseCode) {
               idorCodeParams = {
                  houseCode: this.houseCode
               }
            }
            if (this.currentId) {
               idorCodeParams = {
                  id: this.currentId
               }
            }
            getPlaceDetail({
               ...params,
               ...idorCodeParams
            }).then(({
               code,
               data
            }) => {
               if (code !== 200) {
                  uni.showToast({
                     title: "数据加载失败",
                     icon: 'error'
                  })
                  return
               }
               const dpaEntity = data.doorplateAddressEntity
               this.form.buildingCode = dpaEntity?.buildingCode
               let buildingNameArr = [
                  dpaEntity?.townStreetName,
                  dpaEntity?.neiName,
                  dpaEntity?.streetRuName,
                  dpaEntity?.aoiName,
                  dpaEntity?.buildingName
               ]
               let arr = buildingNameArr.filter(e => {
                  return e != null || e != ''
               })
               // 赋值
               // this.form.placeName = data['placeName']
               Object.keys(this.form).forEach(key => {
                  if (!data[key]) {
                     this.form[key] = data.place[key]
                  } else {
                     this.form[key] = data[key]
                  }
               this.form.placeName = data['placeName']
               Object.keys(this.form).forEach(key => {
                  this.form[key] = data[key] || data.doorplateAddressEntity[key] || '未完善'
                  if (key === "images") {
                     this.form[key] = []
                  }
               })
               this.form.building = arr.join("")
               Object.keys(this.comprehensiveData).forEach(key => {
                  console.log(key);
                  this.comprehensiveData[key].forEach(item => {
                     item.value = data[item.name] || data.doorplateAddressEntity[item
                        .name] || '未完善'
                  })
                  this.publicData[key].forEach(item => {
                     item.value = data[item.name] || data.doorplateAddressEntity[item
                        .name] || '未完善'
                  })
               })
               
               this.form.building = arr.join("")
               Object.keys(this.comprehensiveData).forEach(key => {
                  this.comprehensiveData[key].forEach(item => {
                     if (!data[item.name]) {
                        item.value = data.place[item.name] || '未完善'
                     } else {
                        item.value = data[item.name] || '未完善'
                     }
                  })
                  this.publicData[key].forEach(item => {
                     if (!data[item.name]) {
                        item.value = data.place[item.name] || '未完善'
                     } else {
                        item.value = data[item.name] || '未完善'
                     }
                  })
               data.placePoiLabelVOList.forEach(item => {
                  const label = this.labelList[0].children.find(sl => sl.text === item.labelName)
                  label.isClose = false
                  this.showLabelList.push(label)
               })
            })
         },
@@ -418,7 +500,7 @@
            const that = this
            this.$refs.form.validate().then(valid => {
               if (valid) {
                  if (this.form.images.length > 0) {
                  if (this.form?.images?.length > 0) {
                     let urls = []
                     this.form.images.forEach(e => {
                        urls.push(e.name)
@@ -597,11 +679,11 @@
            this.showLabelList = this.showLabelList.filter(e => e.id != label.id)
            this.activeIds = this.activeIds.filter(e => e != label.id)
         },
         imgPreview(value) {
            uni.previewImage({
               urls: [value],
            })
         },
         imgPreview(value) {
            uni.previewImage({
               urls: [value],
            })
         },
      }
   }
@@ -666,11 +748,11 @@
         background-color: #ffffff;
         padding: 40rpx 30rpx;
      }
      .image {
         padding: 20rpx;
      }
      .image {
         padding: 20rpx;
      }
      .bottom {
         padding: 20rpx;
         background-color: #ffffff;