Lou
2023-12-23 77bb088d2a1bd0092b0fba5ccd24ceccbfe95606
subPackage/workbench/views/cscj.vue
@@ -16,26 +16,40 @@
               </view>
               <u-form-item class="form-item" labelWidth="100" label="场所名称:" :required="isRequiredPlace"
                  :disabled="isDisabled" prop="placeName">
                  <u--input border="none" v-model="form.placeName" placeholder="请输入">
                  <u--input  v-if="!currentId" border="none" v-model="form.placeName" placeholder="请输入">
                  </u--input>
                  <view class="f-30"  v-if="currentId">
                     {{form.placeName || "暂无数据"}}
                  </view>
               </u-form-item>
               <u-form-item @click="popup" class="form-item" labelWidth="100" label="标签:" :required="isRequired"
                  :disabled="isDisabled" prop="label">
                  <u--input border="none" disabled disabledColor="#ffffff" placeholder="请选择">
                  <u--input border="none"  v-model="categoryValue"  disabled disabledColor="#ffffff" placeholder="请选择">
                  </u--input>
                  <u-icon slot="right" name="arrow-right"></u-icon>
                  <u-icon slot="right" name="arrow-right"  v-if="!currentId"></u-icon>
               </u-form-item>
               <view v-if="showLabelList.length" class="label" style="border-bottom:1px solid eff1f3;">
               <!-- <view v-if="showLabelList.length" class="label" style="border-bottom:1px solid eff1f3;">
                  <view v-for="(item,index) in showLabelList" :key="index" class="activeLabel">
                     <u-tag :closable="currentId?false:true" :show="!item.isClose" size="mini"
                        @close="delTag(item)" :text="item.text"></u-tag>
                  </view>
               </view>
               </view> -->
               <!-- <view v-if="categoryValue.length" class="label" style="border-bottom:1px solid eff1f3;">
                  <view v-for="(item,index) in categoryValue" :key="index" class="activeLabel">
                     <u-tag :closable="currentId?false:true"  size="mini"
                        @close="delTag()" :text="item.categoryName"></u-tag>
                  </view>
               </view> -->
               <u-form-item class="form-item" labelWidth="100" label="备注:" prop="remark">
                  <u--input border="none" v-model="form.remark" placeholder="请输入">
                  <u--input  v-if="!currentId" border="none" v-model="form.remark" placeholder="请输入">
                  </u--input>
                  <view class="f-30"  v-if="currentId">
                     {{form.remark || "暂无数据"}}
                  </view>
               </u-form-item>
               <!-- <u-form-item class="form-item" labelWidth="100" label="经纬度:" prop="location">
@@ -45,14 +59,14 @@
               <u-form-item label="经纬度:" prop="location" labelWidth="100">
                  <view class="address-row flex">
                  <view class="address-row flex j-c-s-b a-i-c">
                     <view class="address-content f-28" v-if="form.jwd">
                        {{form.jwd}}
                     </view>
                     <view class="address-content f-28" v-if="!form.jwd" style="color: #c0c4cc;">
                        请选择地址
                     </view>
                     <view class="location-btn c-main f-24" @click="getLocation()">
                     <view class="location-btn c-main f-24" @click="getLocation()"  v-if="!currentId">
                        获取地址
                     </view>
                  </view>
@@ -97,7 +111,7 @@
                  <template slot="titleMore">
                     <view class="title-more">
                        <view class="red item"></view>
                        <view class="orange item">85.9</view>
                        <view class="orange item"></view>
                        <view class="green item"></view>
                     </view>
                  </template>
@@ -127,7 +141,7 @@
                  <template slot="titleMore">
                     <view class="title-more">
                        <view class="red item"></view>
                        <view class="orange item">85.9</view>
                        <view class="orange item"></view>
                        <view class="green item"></view>
                     </view>
                  </template>
@@ -152,11 +166,11 @@
      </view>
      <footer-btn @click="submit" v-if="!currentId" />
      <uni-popup class="citys_win popup_win" ref="uniPopup" type="bottom">
      <!-- <uni-popup class="citys_win popup_win" ref="uniPopup" type="bottom">
         <wyh-tree-select :items="labelList" title="标签选择" :showNav="true" defaultActiveColor="#4586fe"
            :activeIds="activeIds" @clickItem="labelClick" :showCancel="false" :showConfirm="false">
         </wyh-tree-select>
      </uni-popup>
      </uni-popup> -->
      <u-picker :show="showPicker" :defaultIndex="defaultIndex" ref="uPicker" keyName="name" :loading="pickerLoading"
@@ -164,8 +178,8 @@
         @cancel="showPicker = false"></u-picker>
      <u-picker :show="isShowCatePicker" ref="catePicker"  keyName="categoryName"  :columns="categoryList" @confirm="confirmCategory"
         @change="changeCategory"    @cancel="isShowCatePicker = false"></u-picker>
      <u-picker :show="isShowCatePicker"  :defaultIndex="categoryIndex"  ref="catePicker" keyName="categoryName" :columns="categoryList"
         @confirm="confirmCategory" @change="changeCategory" @cancel="isShowCatePicker = false"></u-picker>
   </view>
@@ -379,20 +393,20 @@
            categoryIndex: [],
            firstId: "",
            secondId: "",
            categoryValue:[]
            categoryValue: []
         }
      },
      watch: {
         activeIds: {
            handler(newVal) {
               this.form.label = newVal.join(",")
            }
         },
         "form.buildingCode": {
            handler(newVal) {}
         },
         showLabelList(newVal) {}
      },
      // watch: {
      //    activeIds: {
      //       handler(newVal) {
      //          this.form.label = newVal.join(",")
      //       }
      //    },
      //    "form.buildingCode": {
      //       handler(newVal) {}
      //    },
      //    showLabelList(newVal) {}
      // },
      created() {
         this.buildColumn()
@@ -410,7 +424,7 @@
         if (option.addressType) {
            this.addressType = option.addressType
         }
         if (option.id) {
         if (option.id) {
            this.currentId = option.id
         }
         if (option.houseCode) {
@@ -425,36 +439,36 @@
               title: '详情'
            })
         }
         // this.getCategory();
         this.getCategory();
      },
      onShow() {
         this.getLabel()
         // this.getLocation()
      },
      watch:{
         firstId:{
            handler(newVal,oldVal){
               if(newVal){
                  this.getCategory(2,this.firstId);
      watch: {
         firstId: {
            handler(newVal, oldVal) {
               if (newVal) {
                  this.getCategory(3, this.firstId);
               }
            },
            immediate:true
            immediate: true
         }
         // secondId:{
   //              handler(newVal,oldVal){
         //              handler(newVal,oldVal){
         //       this.getCategory(3,this.secondId);
         //    },            
         //    immediate:true
         // }  
      },
      methods: {
         // getBuildingDetail(params = {}) {
         //    getDoorplateAddressDetail(Object.assign(params, {
@@ -502,36 +516,39 @@
         // },
         //获取分类
          getCategory(level = 1, id) {
         getCategory(level = 2, id) {
            let params = {
               level
            }
            if (level != 1) {
            if (level == 3) {
               params.parentNo = id
            }
            getLabelCate(params).then(res => {
               console.log(res)
               if (res.code == 200) {
                  let index = level- 1;
                  this.$set(this.categoryList,index,res.data);
                  if(level == 1){
                  let index = level - 2;
                  this.$set(this.categoryList, index, res.data);
                  if (level == 2) {
                     this.firstId = res.data[0].categoryNo
                  }
               }
            })
         },
            //选择分类
         //选择分类
         confirmCategory(e) {
               console.log("confirm=>",e)
            let {indexs,value} = e;
            this.categoryIndex = indexs;
            this.categoryValue = value;
            this.form.label = value[value.length -1].id;
            this.isShowCatePicker = false;
            console.log("confirm=>", e)
            let {
               indexs,
               value
            } = e;
            this.categoryIndex = indexs;
            this.categoryValue = value[value.length - 1].categoryName;
            this.form.label = value[value.length - 1].categoryNo;
            this.isShowCatePicker = false;
         },
            //切换分类
         //切换分类
         changeCategory(e) {
            const {
               columnIndex,
@@ -541,9 +558,9 @@
               // 微信小程序无法将picker实例传出来,只能通过ref操作
               picker = this.$refs.catePicker
            } = e
            console.log("change=>",e)
            console.log("change=>", e)
            // 当第一列值发生变化时,变化第二列(后一列)对应的选项
            if (columnIndex === 0) {
               // picker为选择器this实例,变化第二列对应的选项
@@ -553,9 +570,9 @@
               // this.getCategory(2,this.firstId);
            }
            // else if ( columnIndex === 1){
               // picker.setColumnValues(2, this.categoryList[index])
               // this.secondId = e.value[columnIndex].categoryNo;
               // this.getCategory(3,this.secondId)
            // picker.setColumnValues(2, this.categoryList[index])
            // this.secondId = e.value[columnIndex].categoryNo;
            // this.getCategory(3,this.secondId)
            // }
         },
@@ -625,18 +642,26 @@
                  }
               })
               this.form.jwd = `${Number(data.lng).toFixed(6)},${Number(data.lat).toFixed(6)}`
               this.form.building = arr.join("")
               setTimeout(() => {
                  data.placePoiLabelVOList.forEach(item => {
                     let label = this.labelList[0].children.find(sl => sl.text === item
                        .labelName) || {}
                     label['isClose'] = false
                     label?.text && this.showLabelList.push(label)
                  })
               }, 500)
               this.firstId = data.placePoiLabelVOList[0].poiCode;
               // setTimeout(() => {
               //    data.placePoiLabelVOList.forEach(item => {
               //       let label = this.labelList[0].children.find(sl => sl.text === item
               //          .labelName) || {}
               //       label['isClose'] = false
               //       label?.text && this.showLabelList.push(label)
               //    })
               // }, 500)
               this.categoryValue = data.placePoiLabelVOList[data.placePoiLabelVOList.length-1].labelName;
               uni.$u.sleep(500).then(() => {
                  data.placePoiLabelVOList.forEach(item=>{
                    let firstIndex = this.categoryList[0].findIndex(i => i.categoryNo==item.poiCode)
                    let childIndex = this.categoryList[1].findIndex(i => i.categoryNo == item.poiCode)
                    this.categoryIndex = [firstIndex,childIndex]
                  })
               })
               Object.keys(this.comprehensiveData).forEach(key => {
                  this.comprehensiveData[key].forEach(item => {
                     if (!data[item.name]) {
@@ -738,7 +763,7 @@
                  this.form.lat = res.latitude;
                  this.form.lng = res.longitude;
                  this.form.jwd =
                     `${Number(res.latitude).toFixed(6)},${Number(res.longitude).toFixed(6)}`
                     `${Number(res.longitude).toFixed(6)},${Number(res.latitude).toFixed(6)}`
               }
            })
         },
@@ -813,10 +838,10 @@
         },
         //弹出层打开
          popup() {
            this.$refs.uniPopup.open()
            // this.isShowCatePicker = true;
         popup() {
            // this.$refs.uniPopup.open()
            this.isShowCatePicker = true;
         },
         getLabel() {
@@ -853,10 +878,12 @@
            this.showLabelList.sort((a, b) => a.sort - b.sort)
         },
         delTag(label) {
            label.isClose = true
            this.showLabelList = this.showLabelList.filter(e => e.id != label.id)
            this.activeIds = this.activeIds.filter(e => e != label.id)
         delTag() {
            // label.isClose = true
            // this.showLabelList = this.showLabelList.filter(e => e.id != label.id)
            // this.activeIds = this.activeIds.filter(e => e != label.id)
            this.categoryIndex = [];
            this.categoryValue = "";
         },
         imgPreview(value) {
@@ -983,8 +1010,6 @@
   .address-row {
      flex: 1;
      justify-content: flex-end;
      align-items: center;
   }
   .address-content {