1
MrShi
2025-01-22 eecb531137599c1a0bde3c40fc549cd3b2cd5bed
admin/src/views/workorder/components/handleProblem.vue
@@ -43,30 +43,36 @@
                </div>
            </div>
            <el-form :model="form" :rules="rules" ref="form" label-width="100px" class="demo-ruleForm">
                <el-form-item label="处理方式" prop="dealType">
                    <el-radio-group v-model="form.dealType">
                        <el-radio :label="0">转工单</el-radio>
                        <el-radio :label="1">关闭问题</el-radio>
                <el-form-item label="处理方式" prop="dealStatus">
                    <el-radio-group v-model="form.dealStatus">
                        <el-radio :label="1">转工单</el-radio>
                        <el-radio :label="2">关闭问题</el-radio>
                    </el-radio-group>
                </el-form-item>
                <template>
                    <div style="display: flex; align-items: center;" v-if="form.dealType === 0">
                <template v-if="form.dealStatus === 1">
                    <div style="width: 100%; display: flex; align-items: center;">
                        <el-form-item label="位置类型" prop="workOrderAreaType">
                            <el-select v-model="form.workOrderAreaType" placeholder="请选择位置类型">
                            <el-select v-model="form.workOrderAreaType" @change="changeType" placeholder="请选择位置类型">
                                <el-option label="室内维修" :value="0"></el-option>
                                <el-option label="公共区域" :value="1"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="报修区域" prop="rooms">
                            <el-cascader v-model="form.rooms" ref="cascader" @change="getHouseVal" placeholder="请选择报修区域" :options="houseList"
                             :props="{
                                label: 'name',
                                value: 'id',
                                children: 'projectDataVOList'
                            }"></el-cascader>
                            <el-cascader
                                v-model="form.rooms"
                                :disabled="![0,1].includes(form.workOrderAreaType)"
                                ref="cascader"
                                @change="getHouseVal"
                                placeholder="请选择报修区域"
                                :options="form.workOrderAreaType === 0 ? houseList : houseList1"
                                :props="{
                                    label: 'name',
                                    value: 'id',
                                    children: 'projectDataVOList'
                                }" />
                        </el-form-item>
                    </div>
                    <div style="display: flex; align-items: center;">
                    <div style="width: 100%; display: flex; align-items: center;">
                        <el-form-item label="工单分类" prop="workOrderCateId">
                            <el-cascader v-model="form.workOrderCateId" @change="changeSel" placeholder="请选择分类" clearable :options="cateList"
                            :props="{
@@ -75,8 +81,13 @@
                            children: 'childCategoryList'
                          }"></el-cascader>
                        </el-form-item>
                        <el-form-item label="上门时间" prop="workOrderGetDate">
                            <el-date-picker v-model="form.workOrderGetDate" type="date" value-format="yyyy-MM-dd" placeholder="选择上门时间"></el-date-picker>
                        <el-form-item label="上门时间" prop="workOrderGetDate" v-if="form.workOrderAreaType === 0">
                            <el-date-picker
                                v-model="form.workOrderGetDate"
                                type="datetime"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                placeholder="选择上门时间">
                            </el-date-picker>
                        </el-form-item>
                    </div>
                    <el-form-item label="描述" prop="dealInfo">
@@ -99,11 +110,11 @@
                        </el-upload>
                    </el-form-item>
                </template>
                <el-form-item label="关闭说明" v-if="form.dealType === 1">
                <el-form-item label="关闭说明" prop="dealInfo" v-if="form.dealStatus === 2">
                    <el-input
                        type="textarea"
                        :rows="5"
                        maxlength="300"
                        placeholder="请输入关闭问题"
                        v-model="form.dealInfo">
                    </el-input>
@@ -118,6 +129,7 @@
  import GlobalWindow from '@/components/common/GlobalWindow'
  import { fetchList as getCateList } from '@/api/business/category.js'
  import { tree } from '@/api/project/ywProject'
  import { editProblem } from '@/api/ywProblem'
  export default {
    name: "handleProblem",
    extends: BaseOpera,
@@ -128,7 +140,7 @@
        cateList: [],
        base: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch',
        form: {
          dealType: 0,
          dealStatus: 1,
          workOrderAreaType: '',
          workOrderCateId: '',
          workOrderGetDate: '',
@@ -142,8 +154,9 @@
          workOrderRoomId: ''
        },
        houseList: [],
        houseList1: [],
        rules: {
          dealType: [
          dealStatus: [
            { required: true, message: '请选择', trigger: 'blur' }
          ],
          workOrderAreaType: [
@@ -161,11 +174,6 @@
        }
      }
    },
    created() {
      this.config({
        api: '/ywProblem'
      })
    },
    methods: {
      open (title, target) {
        this.title = title
@@ -175,13 +183,32 @@
        this.visible = true
      },
      getHouseVal(e) {
        this.form.workOrderFloorId = e[2]
        this.form.workOrderRoomId = e[3]
        if (this.form.workOrderAreaType === 0) {
          this.form.workOrderProjectId = e[0]
          this.form.workOrderBuildId = e[1]
          this.form.workOrderFloorId = e[2]
          this.form.workOrderRoomId = e[3]
        } else {
          this.form.workOrderProjectId = e[0]
          this.form.workOrderBuildId = e[1]
          this.form.workOrderFloorId = e[2]
        }
      },
      changeType(e) {
        this.form.rooms = []
        this.form.workOrderProjectId = ''
        this.form.workOrderBuildId = ''
        this.form.workOrderFloorId = ''
        this.form.workOrderRoomId = ''
      },
      getHouseTree() {
        tree({}).then(res => {
          this.addParamToArray(res)
          this.houseList = 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) {
@@ -196,6 +223,21 @@
          }
          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)
          }
        }
      },
@@ -219,6 +261,26 @@
          this.cateList = res.records || []
        })
      },
      confirm() {
        this.$refs.form.validate((valid) => {
          if (!valid) {
            return
          }
          this.isWorking = true
          editProblem({
            ...this.form,
            id: this.info.id
          })
            .then(() => {
              this.visible = false
              this.$tip.apiSuccess('操作成功')
              this.$emit('success')
            })
            .finally(() => {
              this.isWorking = false
            })
        })
      }
    }
  }
</script>
@@ -229,6 +291,50 @@
        width: 100%;
        display: flex;
        flex-direction: column;
        .wt_content {
            width: 100%;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            .wt_content_row {
                font-size: 14px;
                color: rgb(51, 51, 51);
                display: flex;
                align-items: self-start;
                .wt_content_row_label {
                    flex-shrink: 0;
                    font-size: 14px;
                    color: rgb(51, 51, 51);
                }
                .wt_content_row_list {
                    flex: 1;
                    display: flex;
                    align-items: center;
                    .wt_content_row_list_img {
                        width: 106px;
                        height: 93px;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                        overflow-x: hidden;
                        margin-right: 15px;
                        &:last-child {
                            margin: 0 !important;
                        }
                        img {
                            width: 100%;
                        }
                    }
                }
            }
        }
    
        .wt_head {
            width: 100%;
@@ -251,50 +357,6 @@
                    color: $primary-color;
                    display: flex;
                    align-items: center;
                }
            }
            .wt_content {
                width: 100%;
                display: flex;
                align-items: center;
                flex-wrap: wrap;
                .wt_content_row {
                    font-size: 14px;
                    color: rgb(51, 51, 51);
                    display: flex;
                    align-items: self-start;
                    .wt_content_row_label {
                        flex-shrink: 0;
                        font-size: 14px;
                        color: rgb(51, 51, 51);
                    }
                    .wt_content_row_list {
                        flex: 1;
                        display: flex;
                        align-items: center;
                        .wt_content_row_list_img {
                            width: 106px;
                            height: 93px;
                            display: flex;
                            align-items: center;
                            justify-content: center;
                            overflow-x: hidden;
                            margin-right: 15px;
                            &:last-child {
                                margin: 0 !important;
                            }
                            img {
                                width: 100%;
                            }
                        }
                    }
                }
            }
        }