From 872968a2f26c884d174b08cba25edaaf7356b2d8 Mon Sep 17 00:00:00 2001 From: linwenling <3256558519@qq.com> Date: 星期一, 12 六月 2023 16:20:05 +0800 Subject: [PATCH] 修改旅游 --- ruoyi-ui/src/views/travel/edit.vue | 292 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 292 insertions(+), 0 deletions(-) diff --git a/ruoyi-ui/src/views/travel/edit.vue b/ruoyi-ui/src/views/travel/edit.vue index e69de29..084b4e4 100644 --- a/ruoyi-ui/src/views/travel/edit.vue +++ b/ruoyi-ui/src/views/travel/edit.vue @@ -0,0 +1,292 @@ +<template> + <div class="app-container"> + <div class="form-header mt"> + <h4 class="dt h4">鏃呮父璐圭敤璇︾粏璁板綍 </h4> + + </div> + + <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"> + + <el-form-item label="寮�濮嬫椂闂�" prop="startTime"> + <el-input v-model="formData.startTime" placeholder="璇疯緭鍏ユ爣棰�" clearable :style="{width: '100%'}" :disabled="dsb"></el-input> + </el-form-item> + + <el-form-item label="缁撴潫鏃堕棿" prop="endTime"> + <el-input v-model="formData.endTime" placeholder="璇疯緭鍏ヤ汉鐗�" clearable :style="{width: '100%'}" :disabled="dsb"> + </el-input> + </el-form-item> + <el-form-item label="鏍囬" prop="title"> + <el-input v-model="formData.title" placeholder="璇疯緭鍏ヤ汉鐗�" clearable :style="{width: '100%'}" :disabled="dsb"> + </el-input> + </el-form-item> + + + <el-form-item size="large"> + <el-button v-if="isShow" type="primary" @click="submitForm" :disabled="dsb">淇敼</el-button> + </el-form-item> + </el-form> + + <el-dialog :visible.sync="dialogVisible"> + <img w-full :src="dialogImageUrl" style="width: 700px; height: 700px" alt="Preview Image" /> + </el-dialog> + </div> +</template> + +<script> +import {addRole, updateRole} from "@/api/system/role"; +import {blobValidate} from "@/utils/ruoyi"; +import errorCode from "@/utils/errorCode"; +import {Message} from "element-ui"; +import { getTravelPriceInfo,updateTravelPrice, uploadPic, download} from "@/api/travel/index"; + +export default { + components: {}, + props: [], + data() { + return { + cdi:"鏃呮父璐圭敤淇℃伅", + udi:"鏃呮父璐圭敤淇敼", + fot:[".jpg",".jif","png"], + fileList:[ + ], + fileListOther:[ + + ], + dsb:true, + btn:false, + isShow:true, + + travelpriceList: [], + + formData: { + id: undefined, + title: undefined, + startTime:undefined, + endTime:undefined, + url: undefined, + }, + dialogImageUrl: '', + dialogVisible: false, + disabled: false, + rules: { + title: [{ + required: true, + message: '璇疯緭鍏ュぇ浜嬫爣棰�', + trigger: 'blur' + }], + familyId: [{ + required: true, + message: '璇疯緭鍏ュ搴彿', + trigger: 'blur' + }], + people: [{ + required: true, + message: '璇疯緭鍏ヤ汉鐗�', + trigger: 'blur' + }], + address: [{ + required: true, + message: '璇疯緭鍏ュ湴鐐�', + trigger: 'blur' + }], + remark: [{ + // required: true, + message: '璇疯緭鍏ュ娉�', + trigger: 'blur' + }], + + }, + typeOptions: [], + } + }, + computed: {}, + watch: {}, + created() { + const id = this.$route.params && this.$route.params.id; + let jd; + if(this.$route.query.detail!=undefined) + { + jd = this.$route.query.detail + this.btn= jd + this.dsb = !jd + this.isShow=true + document.title = "淇敼鏃呰璐圭敤璇︾粏淇℃伅"; + this.$route.meta.title = "淇敼鏃呰璐圭敤璇︾粏淇℃伅";//鍒楄〃鐨勫悕绉� + } + else{ + document.title = "鏃呰璐圭敤璇︾粏淇℃伅"; + this.$route.meta.title = "鏃呰璐圭敤璇︾粏淇℃伅";//鍒楄〃鐨勫悕绉� + this.isShow=true + } + + let _this = this + if (id) { + this.loading = true; + getTravelPriceInfo(id).then((response) => { + this.formData = response.data; + let paths = response.data.url.split(","); + for(let i = 0; i < paths.length; i++) + { + if(paths[i]!="") { + + let pth = paths[i].substr(paths[i].length - 4, paths[i].length) + + if (_this.fot.includes(pth) === true) + _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i]}) + else { + // alert(paths[i]) + let nms = paths[i].split("\/") + let nm = nms[nms.length - 1] + _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i]}) + } + } + } + this.loading = false; + }); + this.getCateInfor() + + } + }, + mounted() {}, + methods: { + + submitForm() { + let ul = this.fileList.map(function (elem){ + return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") + }).join(",") + let uls = this.fileListOther.map(function (elem){ + return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") + }).join(",") + this.formData.url = ul+","+uls + + this.$refs['elForm'].validate(valid => { + + + if (valid) { + if (this.formData.id != undefined) { + updateTravelPrice(this.formData).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + // this.open = false; + this.btn=false + }); + } else { + this.$modal.msgSuccess("淇敼澶辫触"); + + } + } + }) + }, + resetForm() { + this.$refs['elForm'].resetFields() + }, + handlePreview(file) + { + let formData = {'path':"/"+file.url.replace(process.env.VUE_APP_BASE_TRUE_API,"")}; + let lens = formData.path.split(".") + let suffix = lens[lens.length-1] + download(formData).then(async (response) => { + const isLogin = await blobValidate(response); + let nt = new Date().getTime() + let filename = 'familyevent_'+nt+'.'+suffix + const blob = new Blob([response]) + saveAs(blob, filename) + }) + }, + handleRemoveFile(file) { + for(let i = 0; i < this.fileListOther.length; i++) + { + if(this.fileListOther[i].url==file.url) + this.$delete(this.fileListOther,i); + } + }, + handleRemove(file) { + for(let i = 0; i < this.fileList.length; i++) + { + if(this.fileList[i].url==file.url) + this.$delete(this.fileList,i); + } + }, + handleFileCardPreview(file){ + this.dialogFileUrl = file.url; + const Base64 = require('js-base64').Base64 + this.desurl = process.env.VUE_APP_BASE_OTHER_API+'onlinePreview?url='+encodeURIComponent(Base64.encode(this.dialogFileUrl)); + myWindow=window.open(this.desurl,'','width=1200,height=800,top=150,left=300'); + }, + handlePictureCardPreview(file) { + this.dialogImageUrl = file.url; + this.dialogVisible = true; + }, + handleDownload(url) { + var formData = {'path':"/"+url.replace(process.env.VUE_APP_BASE_TRUE_API,"")}; + + let lens = formData.path.split(".") + let suffix = lens[lens.length-1] + download(formData).then(async (response) => { + const isLogin = await blobValidate(response); + let nt = new Date().getTime() + let filename = 'familyevent_'+nt+'.'+suffix + const blob = new Blob([response]) + saveAs(blob, filename) + }) + }, + handleEdit() + { + this.dsb = false + // this.btn = true + this.isShow=false + }, + requestUpload(params) + { + var file = params.file; + var formData = new FormData(); + formData.append('uploadFile', file); + let _this = this + + uploadPic(formData).then(response => { + let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length) + + if(_this.fot.includes(pth) === true) + { + _this.fileList.push({name:response.data.fileName, "url":response.data.url}) + + } + + else{ + _this.fileListOther.push({name:response.data.fileName, url:response.data.url}) + + } + }) + + }, + + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('/zfEvent/export', { + ...this.queryParams + }, `zfEvent_${new Date().getTime()}.xlsx`) + } + + } +} + +</script> + +<style scoped> +.app-container{ + background-color: #FEF7FC; +} +.mt +{ + position: relative; +} +.dt{ + display: block; + +} +.pt{ + right: 10px; + top:-3px; + display: block; + position: absolute; +} +</style> -- Gitblit v1.9.1