From bcac500a760877dc9140f1f381739793706c1af6 Mon Sep 17 00:00:00 2001 From: feige <feige@qq.com> Date: 星期五, 10 十一月 2023 10:29:38 +0800 Subject: [PATCH] 修改图片大小 --- ruoyi-ui/src/views/travel/Info.vue | 415 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 299 insertions(+), 116 deletions(-) diff --git a/ruoyi-ui/src/views/travel/Info.vue b/ruoyi-ui/src/views/travel/Info.vue index 1067e9f..b11bfdf 100644 --- a/ruoyi-ui/src/views/travel/Info.vue +++ b/ruoyi-ui/src/views/travel/Info.vue @@ -1,6 +1,6 @@ <template> <div class="app-container" style="opacity: 1;"> - <h2>鏃呮父缁忓巻琛�</h2> + <h2>姣忔棩琛岀▼</h2> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form-item label="鏃堕棿" > @@ -73,7 +73,7 @@ v-hasPermi="['family:note:export']" >瀵煎叆妯℃澘涓嬭浇</el-button> </el-col> - <el-col :span="1.2"> + <el-col :span="1.5"> <el-upload action="" class="upload-demo" @@ -82,7 +82,7 @@ > <el-button size="mini" type="primary" plain - icon="el-icon-plus" >瀵煎叆</el-button> + icon="el-icon-top">瀵煎叆</el-button> </el-upload> </el-col> @@ -98,10 +98,7 @@ </el-table-column> <el-table-column label="鍦扮偣" prop="address" sortable width="100" /> - <el-table-column label="浜虹墿" prop="people" sortable width="100" /> - <el-table-column label="鏍囬" prop="title" sortable width="100" /> - <el-table-column label="鏃呮湡" prop="travelPeriod" sortable width="100" /> <el-table-column label="鎸佽瘉鏃呮父" prop="certificate" sortable width="100" /> <el-table-column label="璐圭敤" prop="totalPrice" sortable width="100" /> <el-table-column label="鍏垂/鑷垂" prop="self" sortable width="100" > @@ -151,55 +148,6 @@ </el-table-column> </el-table> - <el-dialog :title="title" :visible.sync="openDataScope" width="1000px" append-to-body> - - <el-table v-loading="loading" :data="travelpriceList" @selection-change="handleSelectionChange" @row-click="handleCheck" :row-class-name="tableRowClassName" > - <el-table-column type="selection" width="55" align="center" /> - - <el-table-column label="搴忓彿" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="120"/> - <el-table-column label="鏃堕棿" prop="happenTime" sortable width="100" align="center"> - <template slot-scope="scope">{{scope.row.happenTime? scope.row.happenTime: '鈥斺�斺�斺��'}}</template> - </el-table-column> - <el-table-column label="鍐呭" prop="content" sortable :show-overflow-tooltip="true" width="150" /> - <el-table-column label="鎬婚噾棰�" prop="totalcost" sortable :show-overflow-tooltip="true" width="150" /> - <el-table-column label="椁愯垂" prop="eat" sortable :show-overflow-tooltip="true" width="150" /> - <el-table-column label="浣忓" prop="stay" sortable :show-overflow-tooltip="true" width="150" /> - <el-table-column label="浜ら��" prop="traffic" sortable :show-overflow-tooltip="true" width="150" /> - <el-table-column label="闂ㄧエ" prop="entrance" sortable :show-overflow-tooltip="true" width="150" /> - <el-table-column label="璐墿" prop="shopping" sortable :show-overflow-tooltip="true" width="150" /> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope" v-if="scope.row.roleId !== 1"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['familymodel:property:info']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:role:remove']" - >鍒犻櫎</el-button> - </template> - </el-table-column> - </el-table> - - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - - /> - - - </el-dialog> - <pagination v-show="total>0" :total="total" @@ -211,44 +159,55 @@ <!-- 娣诲姞鎴栦慨鏀硅祫浜т俊鎭厤缃璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> + <el-dialog :title="title" :visible.sync="open" width="60%" append-to-body> <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-width="100px"> - <el-form-item label="鍙拌处" prop="type"> - <el-input v-model="formDat.type" placeholder="璇疯緭鍏ュ唴瀹�" clearable :style="{width: '100%'}" ></el-input> + <h4 class="form-header">琛岀▼鍐呭 </h4> + <el-form-item label="鏍囬" prop="title"> + <el-input v-model="formDat.title" placeholder="璇疯緭鍏ユ爣棰�" clearable :style="{width: '100%'}" > + </el-input> </el-form-item> - <el-form-item label="鏃堕棿" prop="happenTime"> - <el-date-picker + <el-input v-model='formDat.happenTime' type='date' placeholder='閫夋嫨鏃ユ湡' - ></el-date-picker> + ></el-input> </el-form-item> - <el-form-item label="鏀跺叆/鏀嚭" prop="price"> - <el-select v-model="formDat.price" placeholder="璇烽�夋嫨鏀跺叆/鏀嚭" clearable :style="{width: '100%'}" > + <el-form-item label="鍦扮偣" prop="address"> + <el-input v-model="formDat.address" placeholder="璇疯緭鍏ュ湴鐐�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="浜虹墿" prop="people"> + <el-input v-model="formDat.people" placeholder="璇疯緭鍏ヤ汉鐗�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="鏃呮湡" prop="travelPeriod"> + <el-input v-model="formDat.travelPeriod" placeholder="璇疯緭鍏ユ梾鏈�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="鎸佽瘉鏃呮父" prop="certificate"> + <el-select v-model="formDat.certificate" placeholder="璇烽�夋嫨璇佷欢" clearable :style="{width: '80%'}" > + <el-option label="灞呮皯韬唤璇�" value="灞呮皯韬唤璇�"></el-option> + <el-option label="涓存椂韬唤璇�" value="涓存椂韬唤璇�"></el-option> + <el-option label="鎴峰彛鏈�" value="鎴峰彛鏈�"></el-option> + <el-option label="鎶ょ収" value="鎶ょ収"></el-option> + <el-option label="瀛︾敓璇�" value="瀛︾敓璇�"></el-option> + </el-select> + </el-form-item> + <!-- <el-form-item label="璐圭敤" prop="totalPrice"> + <el-input v-model="formDat.totalPrice" placeholder="璇疯緭鍏ユ�诲叡璐圭敤" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> --> + <el-form-item label="鍏垂/鑷垂" prop="self"> + <el-select v-model="formDat.self" placeholder="璇烽�夋嫨鑷垂/鍏垂" clearable :style="{width: '100%'}" > <el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value" ></el-option> </el-select> </el-form-item> - <el-form-item label="閲戦" prop="balance"> - <el-input v-model="formDat.balance" placeholder="璇疯緭鍏ヤ綑棰�" clearable :style="{width: '100%'}" > - </el-input> - </el-form-item> - <el-form-item label="鐢ㄩ��" prop="useFor"> - <el-input v-model="formDat.useFor" placeholder="璇疯緭鍏ョ敤閫�" clearable :style="{width: '100%'}" > - </el-input> - </el-form-item> - <el-form-item label="浣跨敤浜�" prop="usePeople"> - <el-input v-model="formDat.usePeople" placeholder="璇疯緭鍏ヤ娇鐢ㄤ汉" clearable :style="{width: '100%'}" > - </el-input> - </el-form-item> - <el-form-item label="鏀粯鏂瑰紡" prop="kind"> - <el-input v-model="formDat.kind" placeholder="璇疯緭鍏ユ敮浠樻柟寮�" clearable :style="{width: '100%'}" > - </el-input> - </el-form-item> <el-form-item label="澶囨敞" prop="remark"> <el-input v-model="formDat.remark" placeholder="璇疯緭鍏ュ娉�" clearable :style="{width: '100%'}" ></el-input> </el-form-item> + <h4 class="form-header">鐩稿叧鍥剧墖 </h4> <el-upload @@ -307,6 +266,34 @@ </el-upload> </el-form> + <el-form ref="elForm1" :model="formDat1" :rules="rules1" size="medium" label-width="100px"> + <h4 class="form-header">璐圭敤鏄庣粏 </h4> + <el-form-item label="鍐呭" prop="content"> + <el-input v-model="formDat1.content" placeholder="璇疯緭鍏ュ唴瀹�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="浣忓璐圭敤" prop="stay"> + <el-input v-model="formDat1.stay" placeholder="璇疯緭鍏ヤ綇瀹胯垂鐢�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="浜ら�氳垂鐢�" prop="traffic"> + <el-input v-model="formDat1.traffic" placeholder="璇疯緭鍏ヤ氦閫氳垂鐢�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="椁愯垂" prop="eat"> + <el-input v-model="formDat1.eat" placeholder="璇疯緭鍏ラ璐圭敤" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="璐墿璐圭敤" prop="shopping"> + <el-input v-model="formDat1.shopping" placeholder="璇疯緭鍏ヨ喘鐗╄垂鐢�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + <el-form-item label="闂ㄧエ璐圭敤" prop="entrance"> + <el-input v-model="formDat1.entrance" placeholder="璇疯緭鍏ラ棬绁ㄨ垂鐢�" clearable :style="{width: '100%'}" > + </el-input> + </el-form-item> + + </el-form> <h4 class="form-header"> </h4> <div slot="footer" class="dialog-footer"> @@ -330,7 +317,7 @@ //鍦╯ystem/note/index.js涓鍏ユ帴鍙e嚱鏁� --鎺ュソ浜� -import {listTravelPrice,listTravelBase,enload,getTravelPriceInfo,delTravelPrice, addTravelPrice, uploadPic} from "@/api/travel/index"; +import {addTravelBase,listTravelPrice,getTravelBaseInfo,listTravelBase,enload,delTravelBase, uploadPic,updateTravelPrice} from "@/api/travel/index"; export default { name: "Role", @@ -353,6 +340,7 @@ total: 0, // 瀹跺ぇ浜嬭琛ㄦ牸鏁版嵁 travelBase: [], + detailList:[], // 寮瑰嚭灞傛爣棰� title: "", // 鏄惁鏄剧ず寮瑰嚭灞� @@ -375,13 +363,28 @@ dsb:true, btn:false, formDat: { - type: undefined, - createTime: undefined, - useFor: undefined, - usePeople: undefined, - kind:undefined, + people: undefined, + address: undefined, + happenTime: undefined, + title: undefined, + travelPeriod:undefined, + certificate: undefined, + totalPrice: undefined, + self: undefined, remark: undefined, url: undefined, + }, + formDat1: { + eat: undefined, + stay: undefined, + traffic: undefined, + entrance: undefined, + shopping:undefined, + content: undefined, + }, + formDat2: { + id: undefined, + detailList: undefined, }, // 鑿滃崟鍒楄〃 menuOptions: [], @@ -405,51 +408,91 @@ }, // 琛ㄥ崟鏍¢獙 rules: { - usePeople: [{ + people: [{ required: true, - message: '璇疯緭鍏ヤ娇鐢ㄤ汉', + message: '璇疯緭鍏ヤ汉鐗�', trigger: 'blur' }], - useFor: [{ + address: [{ required: true, - message: '璇疯緭鍏ョ敤閫�', + message: '璇疯緭鍏ュ湴鐐�', trigger: 'blur' }], - type: [{ + title: [{ required: true, - message: '璇疯緭鍏ュ彴璐﹀唴瀹�', + message: '璇疯緭鍏ユ爣棰�', trigger: 'blur' }], - balance: [{ + travelPeriod: [{ required: true, - message: '璇疯緭鍏ラ噾棰�', + message: '璇疯緭鍏ユ梾鏈�', trigger: 'blur' }], - kind: [{ - // required: true, - message: '璇疯緭鍏ユ敮浠樻柟寮�', + certificate: [{ + required: true, + message: '璇疯緭鍏ヨ瘉浠�', trigger: 'blur' }], - createTime: [{ + happenTime: [{ required: true, message: '璇烽�夋嫨鏃ユ湡閫夋嫨', trigger: 'change' }], - price: [{ + totalPrice: [{ required: true, - message: '璇烽�夋嫨浜嬮」鍐呭', + message: '璇烽�夋嫨璐圭敤', trigger: 'blur' }], + self: [{ + required: true, + message: '璇烽�夋嫨鍏垂/鑷垂', + trigger: 'change' + }], + + }, + rules1: { + stay: [{ + required: true, + message: '璇疯緭鍏ヤ汉鐗�', + trigger: 'blur' + }], + + content: [{ + required: true, + message: '璇疯緭鍏ュ湴鐐�', + trigger: 'blur' + }], + traffic: [{ + required: true, + message: '璇疯緭鍏ユ爣棰�', + trigger: 'blur' + }], + entrance: [{ + required: true, + message: '璇疯緭鍏ユ梾鏈�', + trigger: 'blur' + }], + eat: [{ + required: true, + message: '璇疯緭鍏ヨ瘉浠�', + trigger: 'blur' + }], + shopping: [{ + required: true, + message: '璇烽�夋嫨鏃ユ湡閫夋嫨', + trigger: 'change' + }], + }, typeOptions: [ { - value: '鏀跺叆', - label: '鏀跺叆', + value: '0', + label: '鑷垂', }, { - value: '鏀嚭', - label: '鏀嚭', + value: '1', + label: '鍏垂', }], typeOptions1: [ { @@ -464,7 +507,10 @@ }; }, created() { + + const id = this.$route.params && this.$route.params.id; + this.getList1(); this.getList(id); }, @@ -508,20 +554,40 @@ getList(fid) { this.loading = true; + this.queryParams.fid = fid this.queryParams.happenStartTime = this.dateRange.length > 0 && this.dateRange[0] this.queryParams.happenEndTime = this.dateRange.length > 0 && this.dateRange[1] - this.queryParams.fid = fid - console.log(this.queryParams) + + // console.log(this.queryParams) // listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listTravelBase(this.queryParams).then(response => { // alert(123) // console.log(response.data) this.travelBase = response.data.data; - console.log(this.travelBase) + // console.log(this.travelBase) this.total = response.data.total; this.loading = false; } ); + + }, + getList1() { + this.loading = true; + const id = this.$route.params && this.$route.params.id; + return new Promise((resolve, reject) => { + listTravelPrice(this.queryParams).then(response => { + // console.log(response.data.data); + const filteredData = response.data.data.find(item => item.id === id); + this.total = response.data.total; + this.loading = false; + const detailList = filteredData.detailList; + // console.log(detailList); + resolve(detailList); + }).catch(error => { + console.error("璇锋眰閿欒:", error); + reject(error); + }); + }); }, handleRemove(file) { for(let i = 0; i < this.fileListOther.length; i++) @@ -591,7 +657,7 @@ handleAdd() { this.reset(); this.open = true; - this.title = "娣诲姞瀹跺涵鏀舵敮鍙拌处"; + this.title = "娣诲姞姣忔棩琛岀▼鍐呭"; }, @@ -619,7 +685,14 @@ this.dialogVisible = true; }, /** 鎻愪氦鎸夐挳锛堟暟鎹潈闄愶級 */ - submitDataScope: function() { + submitDataScope: async function() { + this.formDat2.detailList = []; + console.log("璋冭瘯"); + console.log(this.formDat2.detailList); + await this.getList1().then(detailList => { + this.formDat2.detailList = detailList; + console.log(this.formDat2.detailList); + }); let ul = this.fileList.map(function (elem){ return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") @@ -628,14 +701,44 @@ return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") }).join(",") this.formDat.url = ul+","+uls + const fid = this.$route.params && this.$route.params.id; + this.formDat.feeId = this.$route.params && this.$route.params.id; + this.formDat1.happenTime = this.formDat.happenTime; + this.formDat2.detailList.push(this.formDat1); + this.formDat2.id = this.$route.params && this.$route.params.id; + const stay = parseFloat(this.formDat1.stay); + const traffic = parseFloat(this.formDat1.traffic); + const eat = parseFloat(this.formDat1.eat); + const shopping = parseFloat(this.formDat1.shopping); + const entrance = parseFloat(this.formDat1.entrance); + + const totalPrice = stay + traffic + eat + shopping + entrance; + console.log("鎬昏垂鐢�"); + console.log(totalPrice); + this.formDat.totalPrice=totalPrice; + console.log("111"); + console.log(this.formDat2) + this.$refs["elForm"].validate(valid => { if (valid) { - addEconomy(this.formDat).then(response => { + addTravelBase(this.formDat).then(response => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; - this.getList(); + this.getList(fid); }); + + } + }); + this.$refs["elForm1"].validate(valid => { + if (valid) { + + + updateTravelPrice(this.formDat2).then(response => { + this.$modal.msgSuccess("璐圭敤鏂板鎴愬姛"); + this.open = false; + }); + } }); }, @@ -663,15 +766,95 @@ }, /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { + async handleDelete(row) { const Ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎搴忓彿涓�"' + Ids + '"鐨勬暟鎹」锛�').then(function() { - return delEconomy(Ids); - }).then(() => { - this.getList(); + const id = row.id || this.ids; + + try { + const response = await getTravelBaseInfo(id); + const baseDate = response.data.totalPrice; + console.log("112"); + console.log(baseDate); + + const detailList = await this.getList1(); + this.detailList = detailList; + console.log(this.detailList); + + const targetTotalCost = baseDate; // 鐩爣 totalCost 鍊� + let targetId = null; // 鐩爣鏁版嵁鐨� id + + for (const detail of this.detailList) { + if (detail.totalCost === targetTotalCost) { + targetId = detail.id; + console.log(targetId); + break; + } + } + + const detailList2 = this.detailList.filter((detail) => detail.id !== targetId); + console.log(detailList2); + const formDat3 = {} + formDat3.detailList = detailList2 + const id2 = this.$route.params && this.$route.params.id; + console.log(id2); + formDat3.id = id2; + console.log(formDat3); + await updateTravelPrice(formDat3); + this.open = false; + + await delTravelBase(Ids); + const fid = this.queryParams.fid + this.getList(fid); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + } catch (error) { + console.error(error); + } }, +// async handleDelete(row) { +// const Ids = row.id || this.ids; +// const id = row.id ||this.ids +// await getTravelBaseInfo(id).then(async (response) => { +// const baseDate = response.data.totalPrice; +// console.log("112"); +// console.log(baseDate); + +// // 鑾峰彇璇︾粏鍒楄〃 +// await this.getList1().then((detailList) => { +// this.detailList = detailList; +// console.log(this.detailList); + +// const targetTotalCost = baseDate; // 鐩爣 totalCost 鍊� +// let targetId = null; // 鐩爣鏁版嵁鐨� id + +// for (const detail of this.detailList) { +// if (detail.totalCost === targetTotalCost) { +// targetId = detail.id; +// console.log(targetId); +// break; +// } +// } +// const detailList2 = [...this.detailList].filter((detail) => { +// return detail.id !== targetId; +// }); +// console.log(detailList2); +// const id2 = this.$route.params && this.$route.params.id; +// console.log(id2); +// detailList2.id = id2 +// console.log(typeof detailList2); +// debugger +// updateTravelPrice(detailList2).then(response => { +// this.open = false; +// }); +// }); +// }); +// this.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(function() { +// return delTravelBase(Ids); + +// }).then(() => { +// this.getList(fid); +// this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); +// }).catch(() => {}); +// }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { const Ids = this.ids; -- Gitblit v1.9.1