|  |  | 
 |  |  |          <view class="item">
 | 
 |  |  |             <view class="la"><text class="red">*</text>选择区域</view>
 | 
 |  |  |             <view class="line sel_wrap" @click="showModal1 = true">
 | 
 |  |  |                <view class="left" :class="param.projectName ? '' : 'placeholder9'">{{ param.projectName ? `${param.projectName} ${param.buildingName || ''} ${param.areaType == 0 ? param.roomName || '' : param.floorName || ''}` : '请选择' }}</view>
 | 
 |  |  |                <view class="left" :class="param.projectName ? '' : 'placeholder9'">
 | 
 |  |  |                   {{ param.projectName ? `${param.projectName} ${param.buildingName || ''} ${param.areaType == 0 ? param.roomNum || '' : param.floorName || ''}` : '请选择' }}
 | 
 |  |  |                </view>
 | 
 |  |  |                <u-icon name="arrow-right" color="#999999" size="15"></u-icon>
 | 
 |  |  |             </view>
 | 
 |  |  |          </view>
 | 
 |  |  |          <view class="item">
 | 
 |  |  |             <view class="la"><text class="red">*</text>工单分类</view>
 | 
 |  |  |             <view class="line sel_wrap" @click="showCate1 = true">
 | 
 |  |  |                <view class="left" :class="param.cateName ? '' : 'placeholder9'">
 | 
 |  |  |                   {{ param.cateName ? param.cateName : '请选择' }}</view>
 | 
 |  |  |                <u-icon name="arrow-right" color="#999999" size="15"></u-icon>
 | 
 |  |  |             </view>
 | 
 |  |  |          </view>
 | 
 |  |  |          <view class="item" v-if="param.areaType == 0">
 | 
 |  |  |             <view class="la">上门时间</view>
 | 
 |  |  |             <view class="line sel_wrap" @click="showTime = true">
 | 
 |  |  |                <view class="left" :class="param.getDate ? '' : 'placeholder9'">{{ param.getDate ? param.getDate : '请选择' }}</view>
 | 
 |  |  |                <view class="left" :class="param.getDate ? '' : 'placeholder9'">{{ param.getDate ? param.getDate : '请选择' }}
 | 
 |  |  |                </view>
 | 
 |  |  |                <u-icon name="arrow-right" color="#999999" size="15"></u-icon>
 | 
 |  |  |             </view>
 | 
 |  |  |          </view>
 | 
 |  |  | 
 |  |  |                </view>
 | 
 |  |  |                <view class="upload_file" v-for="(item, i) in fileList" :key="i">
 | 
 |  |  |                   <u-icon class="close" size="20" name="close-circle-fill" color="red"
 | 
 |  |  |                      @click="fileDel('dealBeforeFileList', i)"></u-icon>
 | 
 |  |  |                      @click="fileDel('fileList', i)"></u-icon>
 | 
 |  |  |                   <image v-if="item.type == 0" :src="item.fileurlFull" mode="widthFix"></image>
 | 
 |  |  |                   <video v-if="item.type == 1" :src="item.fileurlFull" :controls="false"></video>
 | 
 |  |  |                </view>
 | 
 |  |  | 
 |  |  |          :columns="buildingList"></u-picker>
 | 
 |  |  |       <u-picker :show="showModal3" keyName="name" @cancel="showModal3 = false" @confirm='confirm3'
 | 
 |  |  |          :columns="floorList"></u-picker>
 | 
 |  |  |       <u-picker :show="showModal4" keyName="name" @cancel="showModal4 = false" @confirm='confirm4'
 | 
 |  |  |       <u-picker :show="showModal4" keyName="roomNum" @cancel="showModal4 = false" @confirm='confirm4'
 | 
 |  |  |          :columns="roomList"></u-picker>
 | 
 |  |  |       <!--  -->
 | 
 |  |  |       <u-datetime-picker :minDate="new Date().getTime()" :show="showTime" @confirm="confirmDate" | 
 |  |  |       <u-datetime-picker :minDate="new Date().getTime()" :show="showTime" @confirm="confirmDate"
 | 
 |  |  |          @cancel="showTime = false" mode="datetime"></u-datetime-picker>
 | 
 |  |  | 
 | 
 |  |  |       <u-picker :show="showCate1" keyName="name" ref="uPicker" @change="changeHandler" @cancel="showCate1 = false"
 | 
 |  |  |          @confirm='confirmCate1' :columns="cateList1"></u-picker>
 | 
 |  |  |    </view>
 | 
 |  |  | </template>
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |       ywProjectPost,
 | 
 |  |  |       ywBuildingPost,
 | 
 |  |  |       ywFloorPost,
 | 
 |  |  |       ywRoomPost, | 
 |  |  |       ywWorkorderCreate
 | 
 |  |  |       ywRoomPost,
 | 
 |  |  |       ywWorkorderCreate,
 | 
 |  |  |       getCategoryPost
 | 
 |  |  |    } from '@/api'
 | 
 |  |  |    import dayjs from 'dayjs';
 | 
 |  |  |    export default {
 | 
 |  |  |       data() {
 | 
 |  |  |          return {
 | 
 |  |  |             param: {},
 | 
 |  |  |             param: {
 | 
 |  |  |                areaName: '室内装修',
 | 
 |  |  |                areaType: 0
 | 
 |  |  |             },
 | 
 |  |  |             showUpload: false,
 | 
 |  |  |             fileList: [],
 | 
 |  |  | 
 | 
 |  |  | 
 |  |  |             showModal1: false,
 | 
 |  |  |             showModal2: false,
 | 
 |  |  |             showModal3: false,
 | 
 |  |  |             showModal4: false, | 
 |  |  |             showModal4: false,
 | 
 |  |  |             showTime: false,
 | 
 |  |  |             showCate1: false,
 | 
 |  |  |             showCate2: false,
 | 
 |  |  |             areaType: [
 | 
 |  |  |                [{
 | 
 |  |  |                      name: '室内装修',
 | 
 |  |  | 
 |  |  |                   }
 | 
 |  |  |                ]
 | 
 |  |  |             ],
 | 
 |  |  |             cateList1: [],
 | 
 |  |  |             cateList2: [],
 | 
 |  |  |             projectList: [],
 | 
 |  |  |             buildingList: [],
 | 
 |  |  |             floorList: [],
 | 
 |  |  | 
 |  |  |       },
 | 
 |  |  |       onLoad() {
 | 
 |  |  |          this.getProject()
 | 
 |  |  |          this.getCate()
 | 
 |  |  |       },
 | 
 |  |  |       methods: { | 
 |  |  |          onSubmit() { | 
 |  |  |             const { param, fileList } = this | 
 |  |  |             ywWorkorderCreate({ | 
 |  |  |                ...param, | 
 |  |  |                // roomId: '', | 
 |  |  |                fileList | 
 |  |  |             }).then(res => { | 
 |  |  |                this.showToast('提交成功') | 
 |  |  |                uni.redirectTo({ | 
 |  |  |                   url: '/pages/workOrder/list' | 
 |  |  |                }) | 
 |  |  |             }) | 
 |  |  |       methods: {
 | 
 |  |  |          onSubmit() {
 | 
 |  |  |             const {
 | 
 |  |  |                param,
 | 
 |  |  |                fileList
 | 
 |  |  |             } = this | 
 |  |  |             if (!param.projectId) return this.showToast('请选择完整的区域') | 
 |  |  |             if (!param.buildingId) return this.showToast('请选择完整的区域') | 
 |  |  |             if (!param.floorName && !param.roomNum) return this.showToast('请选择完整的区域') | 
 |  |  |             if (!param.cateName) return this.showToast('请选择工单分类')
 | 
 |  |  |             ywWorkorderCreate({
 | 
 |  |  |                ...param,
 | 
 |  |  |                // roomId: '',
 | 
 |  |  |                fileList
 | 
 |  |  |             }).then(res => {
 | 
 |  |  |                this.showToast('提交成功')
 | 
 |  |  |                uni.redirectTo({
 | 
 |  |  |                   url: '/pages/workOrder/list'
 | 
 |  |  |                })
 | 
 |  |  |             })
 | 
 |  |  |          },
 | 
 |  |  |          confirm0(e) { | 
 |  |  |          changeHandler(e) {
 | 
 |  |  |             const {
 | 
 |  |  |                columnIndex,
 | 
 |  |  |                value,
 | 
 |  |  |                values, // values为当前变化列的数组内容
 | 
 |  |  |                index,
 | 
 |  |  |                // 微信小程序无法将picker实例传出来,只能通过ref操作
 | 
 |  |  |                picker = this.$refs.uPicker
 | 
 |  |  |             } = e
 | 
 |  |  |             // 当第一列值发生变化时,变化第二列(后一列)对应的选项 | 
 |  |  |             console.log(index); | 
 |  |  |             console.log(index);
 | 
 |  |  |             if (columnIndex === 0) {
 | 
 |  |  |                // picker为选择器this实例,变化第二列对应的选项
 | 
 |  |  |                picker.setColumnValues(1, this.cateList1[0][index].childCategoryList)
 | 
 |  |  |             }
 | 
 |  |  |          },
 | 
 |  |  |          confirmCate1(e) {
 | 
 |  |  |             console.log(e.value[1]); | 
 |  |  |             if(e.value.length == 2){ | 
 |  |  |                this.$set(this.param, 'cateId', e.value[1].id) | 
 |  |  |                this.$set(this.param, 'cateName', e.value[1].name) | 
 |  |  |                this.showCate1 = false | 
 |  |  |             } | 
 |  |  | 				 | 
 |  |  |          },
 | 
 |  |  |          confirm0(e) {
 | 
 |  |  |             const item = e.value[0]
 | 
 |  |  |             this.$set(this.param, 'areaType', item.id)
 | 
 |  |  |             this.$set(this.param, 'areaName', item.name)
 | 
 |  |  |             this.showModal0 = false | 
 |  |  |             this.param = { | 
 |  |  |                areaType: item.id, | 
 |  |  |                areaName: item.name, | 
 |  |  |             this.showModal0 = false
 | 
 |  |  |             this.param = {
 | 
 |  |  |                areaType: item.id,
 | 
 |  |  |                areaName: item.name,
 | 
 |  |  |             }
 | 
 |  |  |          },
 | 
 |  |  |          confirm1(e) {
 | 
 |  |  | 
 |  |  |             this.showModal2 = false
 | 
 |  |  |             this.$set(this.param, 'buildingName', item.name)
 | 
 |  |  |             this.$set(this.param, 'buildingId', item.id)
 | 
 |  |  |             if (this.areaType == 0) {
 | 
 |  |  |                this.getRoom(item.id) | 
 |  |  |             if (this.param.areaType == 0) {
 | 
 |  |  |                this.getRoom(item.id)
 | 
 |  |  |                this.showModal4 = true
 | 
 |  |  |             } else {
 | 
 |  |  |                this.getFloor(item.id) | 
 |  |  |                this.getFloor(item.id)
 | 
 |  |  |                this.showModal3 = true
 | 
 |  |  |             }
 | 
 |  |  |          }, | 
 |  |  |          confirm3(e) { | 
 |  |  |             const item = e.value[0] | 
 |  |  |             this.showModal3 = false | 
 |  |  |             this.$set(this.param, 'floorName', item.name) | 
 |  |  |             this.$set(this.param, 'floorId', item.id) | 
 |  |  |          }, | 
 |  |  |          confirm4(e) { | 
 |  |  |             const item = e.value[0] | 
 |  |  |             this.showModal4 = false | 
 |  |  |             this.$set(this.param, 'roomName', item.name) | 
 |  |  |             this.$set(this.param, 'roomId', item.id) | 
 |  |  |          }, | 
 |  |  |          confirmDate(e) { | 
 |  |  |             this.$set(this.param, 'getDate', dayjs(e.value).format('YYYY-MM-DD HH:mm:ss')); | 
 |  |  |             this.showTime = false | 
 |  |  |          },
 | 
 |  |  |          confirm3(e) {
 | 
 |  |  |             const item = e.value[0]
 | 
 |  |  |             this.showModal3 = false
 | 
 |  |  |             this.$set(this.param, 'floorName', item.name)
 | 
 |  |  |             this.$set(this.param, 'floorId', item.id)
 | 
 |  |  |          },
 | 
 |  |  |          confirm4(e) {
 | 
 |  |  |             const item = e.value[0]
 | 
 |  |  |             this.showModal4 = false
 | 
 |  |  |             this.$set(this.param, 'roomNum', item.roomNum)
 | 
 |  |  |             this.$set(this.param, 'roomId', item.id)
 | 
 |  |  |          },
 | 
 |  |  |          confirmDate(e) {
 | 
 |  |  |             this.$set(this.param, 'getDate', dayjs(e.value).format('YYYY-MM-DD HH:mm:ss'));
 | 
 |  |  |             this.showTime = false
 | 
 |  |  |          },
 | 
 |  |  |          getCate() {
 | 
 |  |  |             getCategoryPost({
 | 
 |  |  |                capacity: 9999,
 | 
 |  |  |                page: 1,
 | 
 |  |  |                model: {
 | 
 |  |  |                   type: 3
 | 
 |  |  |                }
 | 
 |  |  |             }).then(res => {
 | 
 |  |  | 
 | 
 |  |  |                let temp = res.data.records || []
 | 
 |  |  |                if (temp && temp.length > 0) {
 | 
 |  |  |                   this.cateList1 = [temp, temp[0].childCategoryList || []]
 | 
 |  |  |                } else {
 | 
 |  |  |                   this.cateList1 = [temp, []]
 | 
 |  |  |                }
 | 
 |  |  |                console.log(this.cateList1);
 | 
 |  |  |             })
 | 
 |  |  |          },
 | 
 |  |  |          getProject() {
 | 
 |  |  |             ywProjectPost().then(res => {
 | 
 |  |  | 
 |  |  |    }
 | 
 |  |  | 
 | 
 |  |  |    .sub_btn {
 | 
 |  |  |       position: fixed;
 | 
 |  |  |       bottom: 68rpx;
 | 
 |  |  |       left: 40rpx;
 | 
 |  |  |       // position: fixed;
 | 
 |  |  |       // bottom: 68rpx;
 | 
 |  |  |       // left: 40rpx;
 | 
 |  |  |       width: 670rpx;
 | 
 |  |  |       height: 88rpx;
 | 
 |  |  |       height: 88rpx; | 
 |  |  |       margin-top: 80rpx;
 | 
 |  |  |       background: $primaryColor;
 | 
 |  |  |       box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0, 104, 255, 0.3);
 | 
 |  |  |       border-radius: 44rpx;
 | 
 |  |  | 
 |  |  |       font-weight: 500;
 | 
 |  |  |       font-size: 32rpx;
 | 
 |  |  |       color: #FFFFFF;
 | 
 |  |  |    } | 
 |  |  |    .sel_upload_wrap { | 
 |  |  |       width: 100%; | 
 |  |  |       border-top: 1px solid #666666; | 
 |  |  |       box-shadow: 0 1 1 #333333; | 
 |  |  | 	 | 
 |  |  |       .btn { | 
 |  |  |          height: 90rpx; | 
 |  |  |          line-height: 90rpx; | 
 |  |  |          text-align: center; | 
 |  |  |       } | 
 |  |  |    }
 | 
 |  |  | 
 | 
 |  |  |    .sel_upload_wrap {
 | 
 |  |  |       width: 100%;
 | 
 |  |  |       border-top: 1px solid #666666;
 | 
 |  |  |       box-shadow: 0 1 1 #333333;
 | 
 |  |  | 
 | 
 |  |  |       .btn {
 | 
 |  |  |          height: 90rpx;
 | 
 |  |  |          line-height: 90rpx;
 | 
 |  |  |          text-align: center;
 | 
 |  |  |       }
 | 
 |  |  |    }
 | 
 |  |  | </style> |