Lou
2023-11-11 03eaa258e9f6ae5aceb9e26989cd1025d35de147
subPackage/workbench/views/editExamine.vue
@@ -52,7 +52,7 @@
<script>
   import {
      updatePlaceExtData,
      updatePlaceExtData,
      getPlaceDetail
   } from '@/api/placeExp/placeExp.js'
   import uploadMixin from "@/mixin/uploadMixin";
@@ -65,8 +65,8 @@
      },
      data() {
         return {
            form: {
               id: '',
            form: {
               id: '',
               placeId: '',
               localtion: '',
               placeName: '',
@@ -97,44 +97,68 @@
         }
      },
      onShow() {
         this.curSelectSite = uni.getStorageSync('siteInfo')
         this.curSelectSite = uni.getStorageSync('siteInfo')
         this.getCsDetails()
         // this.getLocation()
      },
      methods: {
         getCsDetails() {
            getPlaceDetail({
               placeId: this.curSelectSite.id
            }).then(detailRes => {
               const { code, data } = detailRes
               if (code !== 200) {
                  uni.showToast({
                     title: '数据请求失败',
                     icon: 'error'
                  })
                  return
               }
               const placePractitioner = data?.placePractitioner || []
               Object.keys(this.form).forEach(key => {
                  this.form[key] = data[key]
                  if(key === 'imageUrls' || key === 'planImageUrls') {
                     this.form[key] = []
                     !!data[key] && this.form[key].push()
                  }
      methods: {
         // getLocation() {
         //    uni.chooseLocation({
         //       success: (res) => {
         //          console.log(res);
         //       }
         //    })
         // },
         getCsDetails() {
            getPlaceDetail({
               placeId: this.curSelectSite.id
            }).then(detailRes => {
               const {
                  code,
                  data
               } = detailRes
               if (code !== 200) {
                  uni.showToast({
                     title: '数据请求失败',
                     icon: 'error'
                  })
                  return
               }
               const placePractitioner = data?.placePractitioner || []
               Object.keys(this.form).forEach(key => {
                  this.form[key] = data[key]
                  if (key === 'imageUrls' || key === 'planImageUrls') {
                     this.form[key] = []
                     if (!!data[key]) {
                        data[key] = JSON.parse(data[key])
                        if (Array.isArray(data[key])) {
                           this.form[key] = data[key]
                        }
                     } else {
                        this.form[key].push(data[key])
                     }
                  }
               })
               this.personNum = placePractitioner.length
               this.$nextTick(() => {
                  console.log(placePractitioner);
                  this.$refs.formItemRef.forEach((item, index) => {
                     item.form = placePractitioner[index]
                  })
               })
            })
         },
               console.log(this.form);
               this.personNum = placePractitioner.length
               this.$nextTick(() => {
                  console.log(placePractitioner);
                  this.$refs.formItemRef.forEach((item, index) => {
                     item.form = placePractitioner[index]
                  })
               })
            })
         },
         updatePlaceExt(data) {
            data['imageUrls'] = JSON.stringify(data['imageUrls'])
            data['planImageUrls'] = JSON.stringify(data['planImageUrls'])
            updatePlaceExtData({...data}).then(res => {
               const { code } = res
            data['imageUrls'] = data['imageUrls'].join('、')
            data['planImageUrls'] = data['planImageUrls'].join('、')
            updatePlaceExtData({
               ...data
            }).then(res => {
               const {
                  code
               } = res
               if (code !== 200) {
                  uni.showToast({
                     title: '提交失败',
@@ -151,19 +175,19 @@
                     }, 1500)
                  }
               })
            })
         },
         addPerson() {
            this.personNum++
         },
         submit() {
            const placePractitioner = []
            })
         },
         addPerson() {
            this.personNum++
         },
         submit() {
            const placePractitioner = []
            this.$refs.formItemRef.forEach(item => {
               item.form.placeId = this.form.placeId
               placePractitioner.push(item.form)
            })
               item.form.placeId = this.form.placeId
               placePractitioner.push(item.form)
            })
            this.form.placePractitioner = placePractitioner
            this.updatePlaceExt(this.form)
            this.updatePlaceExt(this.form)
         },
         pushPage() {
            this.$u.func.globalNavigator('/subPackage/workbench/views/cshw')