From 89bd7585736129aa5855ce194cb5f4a9d450582a Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 07 二月 2025 11:48:45 +0800
Subject: [PATCH] 改bug
---
admin/src/views/workorder/components/OperaYwWorkorderWindow.vue | 305 ++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 267 insertions(+), 38 deletions(-)
diff --git a/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue b/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue
index f292342..10a54bb 100644
--- a/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue
+++ b/admin/src/views/workorder/components/OperaYwWorkorderWindow.vue
@@ -1,23 +1,61 @@
<template>
- <GlobalWindow :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
+ <GlobalWindow width="800px" :title="title" :visible.sync="visible" @close="close" :confirm-working="isWorking"
+ @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="鎶ヤ慨鍖哄煙">
+
+ <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="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 label="宸ュ崟鍒嗙被" prop="cateId">
+ <el-cascader v-model="form.areaIds" @change="changeSel" placeholder="璇烽�夋嫨鍒嗙被" clearable :options="cateList"
+ :props="{
+ label: 'name',
+ value: 'id',
+ children: 'childCategoryList'
+ }"></el-cascader>
</el-form-item>
- <el-form-item label="鍒嗙被" prop="cateId">
- <el-select v-model="form.cateId">
- <el-option label="" value=""></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="涓婇棬鏃堕棿" prop="getDate">
- <el-date-picker type="datetime" v-model="form.getDate" format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm:ss"
- placeholder="璇烽�夋嫨涓婇棬鏃堕棿"></el-date-picker>
+ <el-form-item label="涓婇棬鏃堕棿" v-if="form.areaType == 0" prop="getDate">
+ <el-date-picker type="datetime" v-model="form.getDate" format="yyyy-MM-dd HH:mm"
+ value-format="yyyy-MM-dd HH:mm:ss" placeholder="璇烽�夋嫨涓婇棬鏃堕棿"></el-date-picker>
</el-form-item>
<el-form-item label="鐜板満鍥剧墖">
<div class="file_list">
@@ -37,19 +75,23 @@
</div>
</div>
</el-form-item>
- <el-form-item label="鎯呭喌璇存槑" prop="content">
- <el-input type="textarea" :rows="4" v-model="form.content" placeholder="璇疯緭鍏ユ儏鍐佃鏄�" v-trim />
+ <el-form-item label="鎻忚堪" prop="content">
+ <el-input type="textarea" :rows="4" v-model="form.content" placeholder="璇疯緭鍏�" :maxlength="300" v-trim />
</el-form-item>
</el-form>
- <!-- -->
-
</GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
-import { Loading } from 'element-ui'
+import { Loading, Message } from 'element-ui'
+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'
+import { fetchList as getCateList } from '@/api/business/category.js'
+import { rules } from './config'
export default {
name: 'OperaYwWorkorderWindow',
extends: BaseOpera,
@@ -59,11 +101,11 @@
// 琛ㄥ崟鏁版嵁
form: {
id: null,
- creator: '',
- createDate: '',
- editor: '',
+
+ rooms: [],
+
editDate: '',
- isdeleted: '',
+ floor: '',
title: '',
remark: '',
status: '',
@@ -72,12 +114,12 @@
getDate: '',
projectId: '',
buildingId: '',
+ floorId: '',
roomId: '',
userId: '',
- phone: '',
submitDate: '',
cateId: '',
- areaType: '0',
+ areaType: 0,
code: '',
dealStatus: '',
dispatchUserId: '',
@@ -88,14 +130,20 @@
dealInfo: '',
dealType: ''
},
+ houseList: [],
+ houseList1: [],
loadingInstance: null,
// 楠岃瘉瑙勫垯
- rules: {
- },
+ rules,
+ projectList: [],
+ buildList: [],
+ levelList: [],
+ roomList: [],
+ cateList: [],
uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/visitsAdmin/cloudService/public/uploadBatch',
fileList: [],
uploadData: {
- folder: 'HIDDEN_DANGER_FILE'
+ folder: 'YW_WORKORDER_FILE'
},
}
},
@@ -106,11 +154,188 @@
})
},
methods: {
- beforeUpload (file) {
- if (['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb', 'image/jpeg','image/jpg', 'image/png', 'image/gif'].indexOf(file.type) == -1) {
+ open(title, target) {
+ this.title = title
+ this.fileList = []
+ this.visible = true
+ this.getProject()
+ this.getCate()
+ this.getHouseTree()
+ // 鏂板缓
+ if (target == null) {
+ this.form = {
+ id: null,
+ editDate: '',
+ floor: '',
+ title: '',
+ remark: '',
+ status: '',
+ sortnum: '',
+ content: '',
+ getDate: '',
+ projectId: '',
+ buildingId: '',
+ floorId: '',
+ roomId: '',
+ userId: '',
+ submitDate: '',
+ cateId: '',
+ areaType: 0,
+ code: '',
+ dealStatus: '',
+ dispatchUserId: '',
+ dispatchDate: '',
+ dispatchInfo: '',
+ dealUserId: '',
+ dealDate: '',
+ dealInfo: '',
+ dealType: ''
+ }
+ this.$nextTick(() => {
+ this.buildList = []
+ this.roomList = []
+ this.levelList = []
+ this.$refs.form.resetFields()
+ this.form[this.configData['field.id']] = null
+ })
+ return
+ }
+ // 缂栬緫
+ this.$nextTick(() => {
+ this.$refs.form.resetFields()
+ for (const key in this.form) {
+ this.form[key] = target[key]
+ }
+ })
+ },
+ 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 || []
+ 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, 'buildingId', '')
+ this.$set(this.form, 'floorId', '')
+ this.$set(this.form, 'roomId', '')
+ getBuildList({ projectId }).then(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) {
+ this.$set(this.form, 'floorId', '')
+ this.$set(this.form, 'roomId', '')
+ if (this.form.areaType == 1) {
+ this.getLevel(e)
+ } else {
+ this.getRoom(e)
+ }
+
+
+ },
+ getLevel(buildingId) {
+ getFloorList({ buildingId }).then(res => {
+ this.levelList = res
+ })
+ },
+ getRoom(buildingId) {
+ const { form } = this
+ getRoomList({ buildingId }).then(res => {
+ this.roomList = res
+ })
+ },
+ changeSel(e) {
+ if (e && e.length == 2) {
+ this.$set(this.form, 'cateId', e[1])
+ } else {
+ this.$set(this.form, 'cateId', '')
+ }
+ },
+ getCate() {
+ getCateList({
+ model: { type: 3 },
+ capacity: 1000,
+ page: 1,
+ }).then(res => {
+ this.cateList = res.records || []
+ })
+ },
+ beforeUpload(file) {
+ if (['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb', 'image/jpeg', 'image/jpg', 'image/png', 'image/gif'].indexOf(file.type) == -1) {
this.$message.error('璇蜂笂浼犳纭殑瑙嗛/鍥剧墖鏍煎紡')
return false
}
+ if (this.fileList.length > 8) return Message.warning('鐜板満鍥剧墖涓嶈兘瓒呰繃9寮�')
this.loadingInstance = Loading.service({
lock: true,
text: 'Loading',
@@ -120,14 +345,14 @@
},
uploadError() {
this.$nextTick(() => { // 浠ユ湇鍔$殑鏂瑰紡璋冪敤鐨� Loading 闇�瑕佸紓姝ュ叧闂�
- if(this.loadingInstance){
+ if (this.loadingInstance) {
this.loadingInstance.close()
}
})
},
- uploadAvatarSuccess (file) {
+ uploadAvatarSuccess(file) {
this.$nextTick(() => { // 浠ユ湇鍔$殑鏂瑰紡璋冪敤鐨� Loading 闇�瑕佸紓姝ュ叧闂�
- if(this.loadingInstance){
+ if (this.loadingInstance) {
this.loadingInstance.close()
}
})
@@ -146,14 +371,16 @@
fileurlFull: item.url
})
}
- console.log('file', this.fileList)
- // this.$set(this.param, 'faceImg', file.imgurl)
+
+ // console.log('file', this.fileList)
+ this.$set(this.form, 'fileList', this.fileList)
// this.$set(this.param, 'faceImgUrl', file.imgurlfull)
},
- handleDelImg (i) {
+ handleDelImg(i) {
this.fileList.splice(i, 1)
+ this.$set(this.form, 'fileList', this.fileList)
},
- close(){
+ close() {
this.isShowModal = false
this.$emit('close')
}
@@ -164,7 +391,8 @@
.file_list {
display: flex;
flex-wrap: wrap;
- .avatar-uploader{
+
+ .avatar-uploader {
width: 92px;
height: 92px;
display: flex;
@@ -172,6 +400,7 @@
align-items: center;
border: 1px dashed #d9d9d9;
}
+
.item {
width: 92px;
max-height: 92px;
@@ -199,4 +428,4 @@
}
}
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3