zhongrj
2023-11-04 b499b461115f240c477c9142903d1b0a444917bf
租赁新增修改图片上传修改
2 files modified
55 ■■■■ changed files
subPackage/bs/views/rentDetail.vue 54 ●●●● patch | view | raw | blame | history
subPackage/house/roomControl/index.vue 1 ●●●● patch | view | raw | blame | history
subPackage/bs/views/rentDetail.vue
@@ -34,7 +34,7 @@
                </u-form-item>
                <view class="pic">
                    <view class="title">合同上传</view>
                    <u-upload :fileList="imagesList" :previewFullImage="uploadConfig.previewFullImage"
                    <u-upload :fileList="form.images" :previewFullImage="uploadConfig.previewFullImage"
                        :accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple"
                        :maxCount="uploadConfig.maxCount" :capture="uploadConfig.capture" @afterRead="afterReadImg"
                        @delete="deletePic">
@@ -55,11 +55,7 @@
                    <rentForm ref="rentform" />
                </view>
            </view>
        </u-form>
        <!-- 事件类型下拉框 -->
        <select-bus v-if="typeShow" :show="typeShow" v-model="form[selectBusModel]" type="radio"
            :popupTitle="selectBusTitle" :dataLists="selectBusList" @cancel="typeShow = false" @submit="typeSelect">
@@ -95,6 +91,9 @@
    import {
        update
    } from "../../../api/system/role";
    import {
        minioBaseUrl
    } from '@/common/setting'
    export default {
        mixins: [uploadMixin],
        components: {
@@ -110,6 +109,8 @@
                    houseTypeName: "",
                    rentalUseName: "",
                    dueTime: "",
                    fileUrls:"",
                    images:[]
                },
                imagesList: [],
                rules: {
@@ -197,7 +198,6 @@
                this.rentId = id
                this.getCurrentRentInfo()
            }
        },
        mounted() {
            this.currentRole = uni.getStorageSync("activeRole")
@@ -225,10 +225,6 @@
                const time = uni.$u.timeFormat(e.value, 'yyyy-mm-dd')
                this.form.dueTime = time
                this.dueTimeShow = false
            },
            async afterReadImg(e) {
                console.log(this.$store);
            },
            addRentForm() {
                this.rentFormNum++
@@ -258,7 +254,6 @@
                }
            },
            saveOrUpdate() {
                console.log(this.rentalUseName, this.houseTypeName);
                this.$refs.form.validate().then(res => {
                    let rentFormValidGroup = []
                    this.$refs.rentform.forEach(item => {
@@ -273,11 +268,19 @@
                    })
                })
            },
            // 新增操作
            async save() {
                let houseTenantVOList = []
                this.$refs.rentform.forEach(item => {
                    houseTenantVOList.push(item.form)
                })
                if (this.form.images.length > 0) {
                    let urls = []
                    this.form.images.forEach(e => {
                        urls.push(e.name)
                    })
                    this.form.fileUrls = urls.join(",")
                }
                const relationIndex = this.dataList.relation.findIndex(item => item.name === this.relationName)
                const statusIndex = this.dataList.houseType.findIndex(item => item.name === this.houseTypeName)
                const rentalIndex = this.dataList.rentalUse.findIndex(item => item.name === this.rentalUseName)
@@ -289,6 +292,7 @@
                    dueTime: this.form.dueTime,
                    houseStatus: this.dataList.houseType[statusIndex].value,
                    rentalUse: this.dataList.rentalUse[rentalIndex].value,
                    fileUrls:this.form.fileUrls,
                    houseTenantVOList
                }
                const {
@@ -314,11 +318,19 @@
                    }
                })
            },
            // 更新操作
            async update() {
                let houseTenantVOList = []
                this.$refs.rentform.forEach(item => {
                    houseTenantVOList.push(item.form)
                })
                if (this.form.images.length > 0) {
                    let urls = []
                    this.form.images.forEach(e => {
                        urls.push(e.name)
                    })
                    this.form.fileUrls = urls.join(",")
                }
                const relationIndex = this.dataList.relation.findIndex(item => item.name === this.relationName)
                const statusIndex = this.dataList.houseType.findIndex(item => item.name === this.houseTypeName)
                const rentalIndex = this.dataList.rentalUse.findIndex(item => item.name === this.rentalUseName)
@@ -330,6 +342,7 @@
                    dueTime: this.form.dueTime,
                    houseStatus: this.dataList.houseType[statusIndex].value,
                    rentalUse: this.dataList.rentalUse[rentalIndex].value,
                    fileUrls:this.form.fileUrls,
                    houseTenantVOList
                }
                const res = await updateRetalInfo(data)
@@ -358,6 +371,7 @@
                })
                return res.name
            },
            // 获取租赁相关信息
            async getCurrentRentInfo() {
                const {
                    code,
@@ -365,20 +379,34 @@
                        houseRentalList
                    }
                } = await getHouseRentInfo(this.houseCode)
                const images = []
                const {
                    houseStatus,
                    tenantRelationship,
                    rentalUse,
                    rentalTime,
                    dueTime,
                    houseTenantVOList
                    houseTenantVOList,
                    fileUrls
                } = houseRentalList.find(item => item.id === this.rentId)
                // 合同展示处理
                if(fileUrls!=null && fileUrls.length>0){
                    const urls = fileUrls.split(',')
                    // 遍历
                    urls.forEach(e=>{
                        images.push({
                            url:minioBaseUrl + e,
                            name: e
                        })
                    })
                }
                this.form = {
                    relation: tenantRelationship,
                    rentTime: rentalTime,
                    dueTime: dueTime,
                    houseTypeName: houseStatus,
                    rentalUseName: rentalUse
                    rentalUseName: rentalUse,
                    images:images
                }
                this.rentalUseName = this.findObjValue(rentalUse, this.dataList.rentalUse)
                this.relationName = this.findObjValue(tenantRelationship, this.dataList.relation)
subPackage/house/roomControl/index.vue
@@ -266,7 +266,6 @@
                                name: e
                            })
                        })
                    }
                    this.form = {
                        phone,