|  |  |  | 
|---|
|  |  |  | @confirm="confirm"> | 
|---|
|  |  |  | <el-form :model="form" ref="form" :rules="rules"> | 
|---|
|  |  |  | <el-form-item label="位置类型" prop="areaType"> | 
|---|
|  |  |  | <el-select v-model="form.areaType"> | 
|---|
|  |  |  | <el-option label="室内维修" value="0"></el-option> | 
|---|
|  |  |  | <el-option label="公共维修" value="1"></el-option> | 
|---|
|  |  |  | <el-select v-model="form.areaType" @change="changeType"> | 
|---|
|  |  |  | <el-option label="室内维修" :value="0"></el-option> | 
|---|
|  |  |  | <el-option label="公共维修" :value="1"></el-option> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="选择项目" prop="projectId"> | 
|---|
|  |  |  | <el-select v-model="form.projectId" clearable filterable @change="getBuild"> | 
|---|
|  |  |  | <el-option v-for="item in projectList" :label="item.name" :value="item.id" /> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <el-form-item label="报修区域" prop="rooms"> | 
|---|
|  |  |  | <el-cascader | 
|---|
|  |  |  | v-model="form.rooms" | 
|---|
|  |  |  | :disabled="![0,1].includes(form.areaType)" | 
|---|
|  |  |  | ref="cascader" | 
|---|
|  |  |  | @change="getHouseVal" | 
|---|
|  |  |  | placeholder="请选择报修区域" | 
|---|
|  |  |  | :options="form.areaType === 0 ? houseList : houseList1" | 
|---|
|  |  |  | :props="{ | 
|---|
|  |  |  | label: 'name', | 
|---|
|  |  |  | value: 'id', | 
|---|
|  |  |  | children: 'projectDataVOList' | 
|---|
|  |  |  | }" /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item label="选择楼宇" prop="buildingId"> | 
|---|
|  |  |  | <el-select v-model="form.buildingId" clearable filterable @change="changeBuild"> | 
|---|
|  |  |  | <el-option v-for="item in buildList" :label="item.name" :value="item.id" /> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--      <el-form-item label="选择项目" prop="projectId">--> | 
|---|
|  |  |  | <!--        <el-select v-model="form.projectId" clearable filterable @change="getBuild">--> | 
|---|
|  |  |  | <!--          <el-option v-for="item in projectList" :label="item.name" :value="item.id" />--> | 
|---|
|  |  |  | <!--        </el-select>--> | 
|---|
|  |  |  | <!--      </el-form-item>--> | 
|---|
|  |  |  | <!--      <el-form-item label="选择楼宇" prop="buildingId">--> | 
|---|
|  |  |  | <!--        <el-select v-model="form.buildingId" clearable filterable @change="changeBuild">--> | 
|---|
|  |  |  | <!--          <el-option v-for="item in buildList" :label="item.name" :value="item.id" />--> | 
|---|
|  |  |  | <!--        </el-select>--> | 
|---|
|  |  |  | <!--      </el-form-item>--> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <el-form-item v-if="form.areaType == 1" label="选择楼层" prop="floorId"> | 
|---|
|  |  |  | <el-select v-model="form.floorId"> | 
|---|
|  |  |  | <el-option v-for="item in levelList" clearable filterable :label="item.name" :value="item.id" /> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <el-form-item v-if="form.areaType == 0" label="选择房间" prop="roomId"> | 
|---|
|  |  |  | <el-select v-model="form.roomId" clearable filterable> | 
|---|
|  |  |  | <el-option v-for="item in roomList" :label="item.roomNum" :value="item.id" /> | 
|---|
|  |  |  | </el-select> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | <!--      <el-form-item v-if="form.areaType == 1" label="选择楼层" prop="floorId">--> | 
|---|
|  |  |  | <!--        <el-select v-model="form.floorId">--> | 
|---|
|  |  |  | <!--          <el-option v-for="item in levelList" clearable filterable :label="item.name" :value="item.id" />--> | 
|---|
|  |  |  | <!--        </el-select>--> | 
|---|
|  |  |  | <!--      </el-form-item>--> | 
|---|
|  |  |  | <!--      <el-form-item v-if="form.areaType == 0" label="选择房间" prop="roomId">--> | 
|---|
|  |  |  | <!--        <el-select v-model="form.roomId" clearable filterable>--> | 
|---|
|  |  |  | <!--          <el-option v-for="item in roomList" :label="item.roomNum" :value="item.id" />--> | 
|---|
|  |  |  | <!--        </el-select>--> | 
|---|
|  |  |  | <!--      </el-form-item>--> | 
|---|
|  |  |  | <el-form-item label="工单分类" prop="cateId"> | 
|---|
|  |  |  | <el-cascader v-model="form.areaIds" @change="changeSel" placeholder="请选择分类" clearable :options="cateList" | 
|---|
|  |  |  | :props="{ | 
|---|
|  |  |  | 
|---|
|  |  |  | <el-input type="textarea" :rows="4" v-model="form.content" placeholder="请输入" :maxlength="300" v-trim /> | 
|---|
|  |  |  | </el-form-item> | 
|---|
|  |  |  | </el-form> | 
|---|
|  |  |  | <!--  --> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </GlobalWindow> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | import BaseOpera from '@/components/base/BaseOpera' | 
|---|
|  |  |  | import GlobalWindow from '@/components/common/GlobalWindow' | 
|---|
|  |  |  | import { Loading, Message } from 'element-ui' | 
|---|
|  |  |  | import { getProjectList } from '@/api/project/ywProject' | 
|---|
|  |  |  | import { getProjectList, tree } from '@/api/project/ywProject' | 
|---|
|  |  |  | import { getBuildList } from '@/api/project/ywBuilding' | 
|---|
|  |  |  | import { getRoomList } from '@/api/project/ywRoom' | 
|---|
|  |  |  | import { getFloorList } from '@/api/project/yeFloor' | 
|---|
|  |  |  | 
|---|
|  |  |  | // 表单数据 | 
|---|
|  |  |  | form: { | 
|---|
|  |  |  | id: null, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | rooms: [], | 
|---|
|  |  |  |  | 
|---|
|  |  |  | editDate: '', | 
|---|
|  |  |  | floor: '', | 
|---|
|  |  |  | title: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | userId: '', | 
|---|
|  |  |  | submitDate: '', | 
|---|
|  |  |  | cateId: '', | 
|---|
|  |  |  | areaType: '0', | 
|---|
|  |  |  | areaType: 0, | 
|---|
|  |  |  | code: '', | 
|---|
|  |  |  | dealStatus: '', | 
|---|
|  |  |  | dispatchUserId: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | dealInfo: '', | 
|---|
|  |  |  | dealType: '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | houseList: [], | 
|---|
|  |  |  | houseList1: [], | 
|---|
|  |  |  | loadingInstance: null, | 
|---|
|  |  |  | // 验证规则 | 
|---|
|  |  |  | rules, | 
|---|
|  |  |  | 
|---|
|  |  |  | this.visible = true | 
|---|
|  |  |  | this.getProject() | 
|---|
|  |  |  | this.getCate() | 
|---|
|  |  |  | this.getHouseTree() | 
|---|
|  |  |  | // 新建 | 
|---|
|  |  |  | if (target == null) { | 
|---|
|  |  |  | this.form = { | 
|---|
|  |  |  | 
|---|
|  |  |  | userId: '', | 
|---|
|  |  |  | submitDate: '', | 
|---|
|  |  |  | cateId: '', | 
|---|
|  |  |  | areaType: '0', | 
|---|
|  |  |  | areaType: 0, | 
|---|
|  |  |  | code: '', | 
|---|
|  |  |  | dealStatus: '', | 
|---|
|  |  |  | dispatchUserId: '', | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeType(e) { | 
|---|
|  |  |  | this.form.rooms = [] | 
|---|
|  |  |  | this.form.projectId = '' | 
|---|
|  |  |  | this.form.buildingId = '' | 
|---|
|  |  |  | this.form.levelList = '' | 
|---|
|  |  |  | this.form.roomId = '' | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getHouseVal(e) { | 
|---|
|  |  |  | if (this.form.areaType === 0) { | 
|---|
|  |  |  | this.form.projectId = e[0] | 
|---|
|  |  |  | this.form.buildingId = e[1] | 
|---|
|  |  |  | this.form.floorId = e[2] | 
|---|
|  |  |  | this.form.roomId = e[3] | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | this.form.projectId = e[0] | 
|---|
|  |  |  | this.form.buildingId = e[1] | 
|---|
|  |  |  | this.form.floorId = e[2] | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getHouseTree() { | 
|---|
|  |  |  | tree({}).then(res => { | 
|---|
|  |  |  | let arr1 = JSON.parse(JSON.stringify(res)) | 
|---|
|  |  |  | let arr2 = JSON.parse(JSON.stringify(res)) | 
|---|
|  |  |  | this.addParamToArray(arr1) | 
|---|
|  |  |  | this.addParamToArray1(arr2) | 
|---|
|  |  |  | this.houseList = arr1 | 
|---|
|  |  |  | this.houseList1 = arr2 | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | addParamToArray(arr) { | 
|---|
|  |  |  | for (let i = 0; i < arr.length; i++) { | 
|---|
|  |  |  | const currentItem = arr[i].projectDataVOList | 
|---|
|  |  |  | if (currentItem && currentItem.length >= 0) { | 
|---|
|  |  |  | currentItem.forEach(item => { | 
|---|
|  |  |  | if (item.lv === 3) { | 
|---|
|  |  |  | delete item.projectDataVOList | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (currentItem && currentItem.length > 0) { | 
|---|
|  |  |  | this.addParamToArray(currentItem) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | addParamToArray1(arr) { | 
|---|
|  |  |  | for (let i = 0; i < arr.length; i++) { | 
|---|
|  |  |  | const currentItem = arr[i].projectDataVOList | 
|---|
|  |  |  | if (currentItem && currentItem.length >= 0) { | 
|---|
|  |  |  | currentItem.forEach(item => { | 
|---|
|  |  |  | if (item.lv === 2) { | 
|---|
|  |  |  | delete item.projectDataVOList | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (currentItem && currentItem.length > 0) { | 
|---|
|  |  |  | this.addParamToArray1(currentItem) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | close() { | 
|---|
|  |  |  | this.visible = false | 
|---|
|  |  |  | this.$emit('close') | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getProject() { | 
|---|
|  |  |  | getProjectList({}).then(res => { | 
|---|
|  |  |  | this.projectList = res | 
|---|
|  |  |  | this.projectList = res || [] | 
|---|
|  |  |  | if(this.projectList.length > 0){ | 
|---|
|  |  |  | this.$set(this.form, 'projectId', this.projectList[0].id) | 
|---|
|  |  |  | this.getBuild(this.projectList[0].id) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | getBuild(projectId) { | 
|---|
|  |  |  | 
|---|
|  |  |  | this.$set(this.form, 'floorId', '') | 
|---|
|  |  |  | this.$set(this.form, 'roomId', '') | 
|---|
|  |  |  | getBuildList({ projectId }).then(res => { | 
|---|
|  |  |  | this.buildList = res | 
|---|
|  |  |  | this.buildList = res || [] | 
|---|
|  |  |  | // if(projectId && this.buildList.length > 0){ | 
|---|
|  |  |  | //   this.$set(this.form, 'buildingId', this.buildList[0].id) | 
|---|
|  |  |  | //   this.changeBuild(this.buildList[0].id) | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | changeBuild(e) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </style> | 
|---|
|  |  |  | </style> | 
|---|