From b2f9340443b60b9f3912bdab6a1daa8f61471c02 Mon Sep 17 00:00:00 2001 From: linwenling <3256558519@qq.com> Date: 星期二, 16 五月 2023 03:24:16 +0800 Subject: [PATCH] 修改家庭收支台账bug --- ruoyi-ui/src/views/economy/economyInfo.vue | 106 +++++++++++++---- ruoyi-ui/src/views/economy/index.vue | 237 ++++++++++++++++++-------------------- 2 files changed, 190 insertions(+), 153 deletions(-) diff --git a/ruoyi-ui/src/views/economy/economyInfo.vue b/ruoyi-ui/src/views/economy/economyInfo.vue index 9b0c4cc..2dab199 100644 --- a/ruoyi-ui/src/views/economy/economyInfo.vue +++ b/ruoyi-ui/src/views/economy/economyInfo.vue @@ -2,7 +2,7 @@ <div class="app-container"> <div class="form-header mt"> <h4 class="dt h4">瀹跺涵鏀舵敮鍙拌处淇℃伅 </h4> - <el-button type="primary" class="pt" icon="el-icon-edit" @click="handleEdit()" :disabled="btn">缂栬緫</el-button> + </div> <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="120px"> @@ -61,20 +61,21 @@ > <span class="el-upload-list__item-actions"> <span + v-if="isShow" class="el-upload-list__item-preview" @click="handlePictureCardPreview(file)" > <i class="el-icon-zoom-in"></i> </span> <span - v-if="!disabled" + v-if="isShow" class="el-upload-list__item-delete" @click="handleDownload(file.url)" > <i class="el-icon-download"></i> </span> <span - v-if="!disabled" + v-if="isShow" class="el-upload-list__item-delete" @click="handleRemove(file)" > @@ -92,25 +93,58 @@ :file-list="fileListOther" class="upload-demo" multiple - :on-preview="handlePreview" - + list-type="picture-card" + :on-preview="handleFileCardPreview" :on-remove="handleRemove" :http-request="requestUpload" :show-file-list="true" > - <el-button type="primary">Click to upload</el-button> - <template #tip> - <div class="el-upload__tip"> - </div> - </template> + + <i slot="default" class="el-icon-plus"></i> + <div slot="file" slot-scope="{file}"> + <img + class="el-upload-list__item-thumbnail" + src="../../assets/401_images/401.gif" + alt="" + style="width: 147px; height: 147px" + fit="cover" + > + <span class="el-upload-list__item-actions"> + <span + v-if="isShow" + class="el-upload-list__item-preview" + @click="handleFileCardPreview(file)" + > + <i class="el-icon-zoom-in"></i> + </span> + <span + v-if="isShow" + @click="handleRemove(file)" + class="el-upload-list__item-delete" + + > + <i class="el-icon-download"></i> + </span> + <span + v-if="isShow" + class="el-upload-list__item-delete" + @click="handleRemoveFile(file)" + > + <i class="el-icon-delete"></i> + </span> + </span> + + + </div> </el-upload> <el-form-item size="large"> - <el-button type="primary" @click="submitForm" :disabled="dsb">淇敼</el-button> + <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" alt="Preview Image" /> @@ -118,7 +152,7 @@ </div> </template> <script> -import {getEconomyInfo, uploadPic, download, getCategory} from "@/api/economy/index"; +import {getEconomyInfo, uploadPic, download, updateEconomy} from "@/api/economy/index"; import {addRole, updateRole} from "@/api/system/role"; import {blobValidate} from "@/utils/ruoyi"; import errorCode from "@/utils/errorCode"; @@ -139,6 +173,7 @@ ], dsb:true, btn:false, + isShow:true, formData: { type: undefined, createTime: undefined, @@ -214,12 +249,14 @@ 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=false } let _this = this @@ -315,29 +352,34 @@ download(formData).then(async (response) => { const isLogin = await blobValidate(response); let nt = new Date().getTime() - let filename = 'economy_'+nt+'.'+suffix + let filename = 'familyevent_'+nt+'.'+suffix const blob = new Blob([response]) saveAs(blob, filename) }) }, - - - - handlePictureCardPreview(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'); - - }, -//鍒犻櫎鍥剧墖 - handleRemoveFile(file,) { - + 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,"")}; @@ -347,7 +389,7 @@ download(formData).then(async (response) => { const isLogin = await blobValidate(response); let nt = new Date().getTime() - let filename = 'property_'+nt+'.'+suffix + let filename = 'familyevent_'+nt+'.'+suffix const blob = new Blob([response]) saveAs(blob, filename) }) @@ -355,7 +397,8 @@ handleEdit() { this.dsb = false - this.btn = true + // this.btn = true + this.isShow=false }, requestUpload(params) { @@ -379,6 +422,13 @@ } }) + }, + + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download('/zfEconomy/export', { + ...this.queryParams + }, `zfEconomy_${new Date().getTime()}.xlsx`) } } diff --git a/ruoyi-ui/src/views/economy/index.vue b/ruoyi-ui/src/views/economy/index.vue index 1a994f5..5c818e4 100644 --- a/ruoyi-ui/src/views/economy/index.vue +++ b/ruoyi-ui/src/views/economy/index.vue @@ -22,20 +22,14 @@ @keyup.enter.native="handleQuery" /> </el-form-item> - <el-form-item label="鍩洪噾/鍙拌处" prop="type" > - <el-select - v-model="queryParams.type" - placeholder="鍩洪噾/鍙拌处" - clearable - style="width: 240px" - > - <el-option - v-for="dict in typeOptions" - :key="dict.value" - :label="dict.label" - :value="dict.value" + <el-form-item label="绫诲瀷" prop="type"> + <el-input + v-model="queryParams.type" + placeholder="璇疯緭鍏ョ被鍨�" + clearable + style="width: 240px" + @keyup.enter.native="handleQuery" /> - </el-select> </el-form-item> <el-form-item label="鐢ㄩ��" prop="useFor"> @@ -52,7 +46,6 @@ <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-row :gutter="10" class="mb8"> <el-col :span="1.5"> @@ -88,76 +81,74 @@ >瀵煎嚭</el-button> </el-col> <el-col :span="1.5"> - <el-button - type="warning" - plain - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['family:note:export']" - >瀵煎叆妯℃澘涓嬭浇</el-button> - </el-col> - <el-col :span="1.2"> - <el-upload - action="" - class="upload-demo" - :show-file-list="false" - :http-request="handleEnport" - > - <el-button size="mini" type="primary" - plain - icon="el-icon-plus" >瀵煎叆</el-button> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['family:note:export']" + >瀵煎叆妯℃澘涓嬭浇</el-button> + </el-col> + <el-col :span="1.2"> + <el-upload + action="" + class="upload-demo" + :show-file-list="false" + :http-request="handleEnport" + > + <el-button size="mini" type="primary" + plain + icon="el-icon-plus" >瀵煎叆</el-button> - </el-upload> - </el-col> + </el-upload> + </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> <!-- 搴忓彿銆佸熀閲�/鍙拌处銆佹椂闂淬�佹敹鍏�/鏀嚭銆佺敤閫斻�佷娇鐢ㄤ汉銆佺幇閲�/鑷姩鎵e垝銆佷綑棰濄�佺數瀛愭枃浠躲�佸娉� 鎿嶄綔--> <!-- 杩欓噷鏈変釜familyList鏁扮粍 鏄湪data()涓畾涔夌殑 --> - <el-table v-loading="loading" :data="economyList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" style="background: #FFEFF2; border-radius: 14px 14px 14px 14px;"> + <el-table v-loading="loading" :data="economyList" @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="type" sortable width="120" > - <template slot-scope="scope"> - {{ getSrc1(scope.row.type) }} - </template> - </el-table-column> - <el-table-column label="鏃堕棿" align="center" sortable prop="createTime" width="180"> <template slot-scope="scope"> - <span>{{ parseTime(scope.row.createTime) }}</span> + {{ getSrc1(scope.row.type) }} </template> </el-table-column> - + <el-table-column label="鍙戠敓鏃堕棿" prop="createTime" sortable width="100" align="center"> + <template slot-scope="scope">{{scope.row.createTime? scope.row.createTime: '鈥斺�斺�斺��'}}</template> + </el-table-column> + <el-table-column label="鍙拌处" prop="type" sortable width="100" /> <el-table-column label="鏀跺叆/鏀嚭" prop="price" sortable width="100" /> <el-table-column label="鐢ㄩ��" prop="useFor" sortable width="100" /> - <!-- <el-table-column label="浜嬮」鍐呭" prop="content" sortable :show-overflow-tooltip="true" width="150" /> --> + <el-table-column label="浣跨敤浜�" prop="usePeople" sortable width="100" /> <el-table-column label="鐜伴噾/鑷姩鎵e垝" prop="kind" sortable width="130" > - <template slot-scope="scope"> + <template slot-scope="scope"> {{ getSrc2(scope.row.kind) }} - </template> + </template> </el-table-column> <el-table-column label="浣欓" prop="balance" sortable width="100" /> <el-table-column label="鐢靛瓙鏂囦欢" prop="url" align="center" sortable width="110" > <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> + <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"> @@ -166,7 +157,7 @@ type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" - v-hasPermi="['system:role:edit']" + v-hasPermi="['familymodel:economy:info']" >淇敼</el-button> <el-button size="mini" @@ -175,7 +166,7 @@ @click="handleDelete(scope.row)" v-hasPermi="['system:role:remove']" >鍒犻櫎</el-button> - <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']"> + <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['familymodel:economy:info']"> <el-button size="mini" type="text" icon="el-icon-d-arrow-right" @click="handleCheck(scope.row)">鏌ョ湅璇︽儏</el-button> </el-dropdown> @@ -196,16 +187,16 @@ <!-- 璁惧鍚嶇О銆佹椂闂淬�佽喘涔颁汉銆佷簨椤瑰唴瀹广�佸瓨鏀惧湴鐐广�佸娉ㄣ�佺數瀛愭枃浠� --> <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> <el-form ref="elForm" :model="formDat" :rules="rules" size="medium" label-width="100px"> - <el-form-item label="鍩洪噾/鍙拌处" prop="type"> - <el-select v-model="formDat.type" 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="type"> + <el-select v-model="formDat.type" 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="createTime"> + <el-form-item label="鏃堕棿" prop="happenTime"> <el-date-picker - v-model='formDat.createTime' + v-model='formDat.happenTime' type='date' placeholder='閫夋嫨鏃ユ湡' ></el-date-picker> @@ -222,19 +213,15 @@ </el-input> </el-form-item> <el-form-item label="鐜伴噾/鑷姩鎵e垝" prop="kind"> - <el-select v-model="formDat.kind" placeholder="璇烽�夋嫨鐜伴噾/鑷姩鎵e垝" clearable :style="{width: '100%'}" > - <el-option v-for="(item, index) in typeOptions1" :key="index" :label="item.label" :value="item.value" - ></el-option> - </el-select> - </el-form-item> + <el-select v-model="formDat.kind" placeholder="璇烽�夋嫨鐜伴噾/鑷姩鎵e垝" clearable :style="{width: '100%'}" > + <el-option v-for="(item, index) in typeOptions1" :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="familyId"> - <el-input v-model="formDat.familyId" 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> @@ -432,50 +419,50 @@ }], }, typeOptions: [ - { - value: '0', - label: '鍩洪噾', -}, -{ - value: '1', - label: '鍙拌处', -} + { + value: '0', + label: '鍩洪噾', + }, + { + value: '1', + label: '鍙拌处', + } ], typeOptions1: [ - { - value: '0', - label: '鐜伴噾', -}, -{ - value: '1', - label: '鑷姩鎵e垝', -} + { + value: '0', + label: '鐜伴噾', + }, + { + value: '1', + label: '鑷姩鎵e垝', + } ], }; }, created() { this.getList(); - this.getCateInfor() + this.getCateInfor() }, methods: { - //鍩洪噾/鍙拌处鐨勯�夋嫨 - getSrc1(type) { - if (type === 0) { - return '鍩洪噾' - }else { - return '鍙拌处' - } - }, + //鍩洪噾/鍙拌处鐨勯�夋嫨 + getSrc1(type) { + if (type === 0) { + return '鍩洪噾' + }else { + return '鍙拌处' + } + }, - getSrc2(kind) { - if (kind == 0) { - return '鐜伴噾' - }else { - return '鑷姩鎵e垝' - } - }, + getSrc2(kind) { + if (kind == 0) { + return '鐜伴噾' + }else { + return '鑷姩鎵e垝' + } + }, // 鍙栨秷鎸夐挳 cancelData() { @@ -503,7 +490,7 @@ // console.log(this.queryParams) // listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => { - listEconomy(this.queryParams).then(response => { + listEconomy(this.queryParams).then(response => { // alert(123) // console.log(response.data) this.economyList = response.data.data; @@ -521,15 +508,15 @@ } }, getCateInfor() - { - let _this = this - getCategory().then(response=>{ + { + let _this = this + getCategory().then(response=>{ - response.data.itemValues.replace("{","").replace("}","").split(",").map(elem=>{ - _this.typeOptions.push({"label":elem.split(":")[0], "value":elem.split(":")[0]}) + response.data.itemValues.replace("{","").replace("}","").split(",").map(elem=>{ + _this.typeOptions.push({"label":elem.split(":")[0], "value":elem.split(":")[0]}) + }) }) - }) - }, + }, // 鍙栨秷鎸夐挳 cancel() { this.open = false; @@ -682,7 +669,7 @@ let _this = this alert(file) enload(formData).then(response => { - _this.getList(); + _this.getList(); Message({ message: "瀵煎叆鎴愬姛", type: 'warning' }) }).catch(err) @@ -690,7 +677,7 @@ Message({ message: "瀵煎叆澶辫触", type: 'error' }) } - } + } }; </script> -- Gitblit v1.9.1