From c4d4c5d25cd78fa302fe07a824c8d7b3412bd9f1 Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期二, 06 五月 2025 16:42:15 +0800 Subject: [PATCH] 修改内容 --- ruoyi-ui/src/views/travel/Info.vue | 597 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 398 insertions(+), 199 deletions(-) diff --git a/ruoyi-ui/src/views/travel/Info.vue b/ruoyi-ui/src/views/travel/Info.vue index 5c933ef..8fcee82 100644 --- a/ruoyi-ui/src/views/travel/Info.vue +++ b/ruoyi-ui/src/views/travel/Info.vue @@ -1,7 +1,7 @@ <template> <div class="app-container" style="opacity: 1;"> - <h2>鏃呮父缁忓巻琛�</h2> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> + <h2>姣忔棩琛岀▼</h2> +<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form-item label="鏃堕棿" > <el-date-picker @@ -28,9 +28,9 @@ <el-button size="mini" @click="handleQuery" style=" width: 65px; height: 32px;background: #FFDDE3;border-radius:6px 6px 6px 6px;opacity:1;">鎼滅储</el-button> <el-button size="mini" @click="resetQuery" style=" width: 65px;height: 32px; background: #FFDDE3; border-radius:6px 6px 6px 6px;opacity: 1;">閲嶇疆</el-button> </el-form-item> - </el-form> + </el-form> --> - <el-row :gutter="10" class="mb8"> +<!-- <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> <el-button type="primary" @@ -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,123 +82,77 @@ > <el-button size="mini" type="primary" plain - icon="el-icon-plus" >瀵煎叆</el-button> + icon="el-icon-top">瀵煎叆</el-button> </el-upload> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> + </el-row> --> - <el-table v-loading="loading" :data="travelBase" @selection-change="handleSelectionChange" @row-click="handleCheck" :row-class-name="tableRowClassName" style="background: #FFEFF2; border-radius: 14px 14px 14px 14px;"> - <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="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" > - <template slot-scope="scope">{{scope.row.self==0?'鍏垂':'鑷垂'}}</template> - </el-table-column> - <el-table-column label="鐢靛瓙鏂囦欢" prop="url" width="160" > - <template slot-scope="scope" > - <img - class="el-upload-list__item-thumbnail" - src="../../assets/images/deviceLis.png" - alt="" - style="width: 35px; height: 35px;" - fit="cover" - v-if="scope.row.url !== ','" - > - <img - class="el-upload-list__item-thumbnail" - src="../../assets/images/deviceA.png" - alt="" - style="width: 35px; height: 35px;" - fit="cover" - v-if="scope.row.url === ','" - > - </template> - </el-table-column> - <el-table-column label="澶囨敞" prop="remark" sortable width="100" /> - - - <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:economy: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> - - <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> + <el-table v-loading="loading" :data="travelBase" style="background: #FFEFF2; border-radius: 14px 14px 14px 14px;" :row-class-name="tableRowClassName1" > + <el-table-column label="搴忓彿" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="50px"/> + + <el-table-column label="鏃堕棿" prop="happenDate" sortable width="100" align="center" > + <template slot-scope="scope">{{scope.row.happenDate? scope.row.happenDate: '鈥斺�斺�斺��'}}</template> + </el-table-column> + + <el-table-column label="鍦扮偣" prop="address" sortable width="100" /> + + <el-table-column label="寤虹瓚" prop="scenic" sortable width="100" /> + <!-- <el-table-column label="鏃呮湡" prop="travelPeriod" sortable width="100" /> --> + <el-table-column label="浣跨敤璇佷欢" prop="document" sortable width="100" /> + <el-table-column label="杞︽/鑸彮" prop="flight" sortable width="120px" /> + <el-table-column label="椁愯垂" prop="eat" sortable width="70px" /> + <el-table-column label="浣忓璐�" prop="stay" sortable width="100px" /> + <el-table-column label="浜ら��" prop="travel" sortable width="70px" /> + <el-table-column label="闂ㄧエ" prop="entrance" sortable width="70px" /> + <el-table-column label="鍏跺畠璐圭敤" prop="otherCost" sortable width="120px" /> + <el-table-column label="澶囨敞" prop="backInfo" sortable width="120px" /> + + <el-table-column label="鐢靛瓙鏂囦欢" prop="url" width="160" > + <template slot-scope="scope" > + <img + class="el-upload-list__item-thumbnail" + src="../../assets/images/deviceLis.png" + alt="" + style="width: 35px; height: 35px;" + fit="cover" + v-if="!(scope.row.url === '' || scope.row.url === ',' || scope.row.url === null)" + > + <img + v-else + class="el-upload-list__item-thumbnail" + src="../../assets/images/deviceA.png" + alt="" + style="width: 35px; height: 35px;" + fit="cover" + > + </template> + </el-table-column> + <!-- <el-table-column label="澶囨敞" prop="remark" sortable width="100" />--> + + + <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" v-if="userId != 2"> + <template slot-scope="scope" v-if="scope.row.roleId !== 1"> + <!-- <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate1(scope.row)" + v-hasPermi="['familymodel:economy:info']" + >淇敼</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete1(scope.row)" + v-hasPermi="['system:role:remove']" + >鍒犻櫎</el-button> --> + <el-button size="mini" type="text" icon="el-icon-d-arrow-right" @click="handleCheck1(scope.row)">鏌ョ湅璇︽儏</el-button> + + </template> + </el-table-column> + </el-table> <pagination v-show="total>0" @@ -211,44 +165,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 @@ -295,7 +260,7 @@ class="upload-demo" multiple - :on-remove="handleRemoveFile" + :on-remove="handleRemove" :http-request="requestUpload" :show-file-list="true" > @@ -305,6 +270,34 @@ </div> </template> </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> @@ -330,7 +323,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 +346,7 @@ total: 0, // 瀹跺ぇ浜嬭琛ㄦ牸鏁版嵁 travelBase: [], + detailList:[], // 寮瑰嚭灞傛爣棰� title: "", // 鏄惁鏄剧ず寮瑰嚭灞� @@ -365,8 +359,16 @@ deptNodeAll: false, // 鏃ユ湡鑼冨洿 dateRange: [], + queryParams: { + pageNum: 1, + pageSize: 10, + + }, // 鏁版嵁鑼冨洿閫夐」 - fot:[".jpg",".jif"], + // 鏁版嵁鑼冨洿閫夐」 + fot:['.bmp','.jpg','.jpeg','.png','.tif','.gif','.pcx','.tga','.exif','.fpx', + '.svg','.psd','.cdr','.pcd','.dxf','.ufo','.eps','.ai','.aw','.WMF','.webp','.apng'], + fileList:[ ], fileListOther:[ @@ -375,13 +377,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 +422,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 +521,10 @@ }; }, created() { + + const id = this.$route.params && this.$route.params.id; + // this.getList1(); this.getList(id); }, @@ -508,29 +568,44 @@ getList(fid) { this.loading = true; - 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) + // this.queryParams.happenStartTime = this.dateRange.length > 0 && this.dateRange[0] + // this.queryParams.happenEndTime = this.dateRange.length > 0 && this.dateRange[1] + + let _this = this + // // console.log(this.queryParams) // listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => { - listTravelBase(this.queryParams).then(response => { + listTravelBase(fid).then(response => { // alert(123) - // console.log(response.data) - this.travelBase = response.data.data; - console.log(this.travelBase) - this.total = response.data.total; - this.loading = false; + console.log(response.data) + // console.log(response.data.data) + _this.travelBase = response.data; + // console.log(this.travelBase) + + _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.fileList.length; i++) - { - if(this.fileList[i].url==file.url) - this.$delete(this.fileList,i); - } - }, - handleRemoveFile(file) { for(let i = 0; i < this.fileListOther.length; i++) { if(this.fileListOther[i].url==file.url) @@ -573,7 +648,7 @@ deptCheckStrictly: true, remark: undefined }; - this.resetForm("form"); + this.resetForm("elForm"); }, /** 鎼滅储鎸夐挳鎿嶄綔 */ handleQuery() { @@ -598,7 +673,7 @@ handleAdd() { this.reset(); this.open = true; - this.title = "娣诲姞瀹跺涵鏀舵敮鍙拌处"; + this.title = "娣诲姞姣忔棩琛岀▼鍐呭"; }, @@ -626,7 +701,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,"") @@ -635,22 +717,46 @@ 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); }); + } }); - // 娓呯┖formDat瀵硅薄鐨勬暟鎹� - Object.keys(this.formDat).forEach(key => { - this.formDat[key] = ''; + this.$refs["elForm1"].validate(valid => { + if (valid) { + + + updateTravelPrice(this.formDat2).then(response => { + this.$modal.msgSuccess("璐圭敤鏂板鎴愬姛"); + this.open = false; + }); + + } }); - this.handleRemove(this.fileList[0]); - this.handleRemoveFile(this.fileListOther[0]); }, requestUpload(params) { @@ -676,14 +782,107 @@ }, /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - 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(() => {}); +// }, + //闅旇鍙樿壊 + tableRowClassName1({ row, rowIndex }) { + if (rowIndex % 2 == 0) { + return "statistics-warning-row1"; + } else { + return "statistics-warning-row"; + } + }, + handleCheck1(row){ + const id = row.id; + // alert(id) + this.$router.push("/self/travel/travelInfo/" + id); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { -- Gitblit v1.9.1