From ef6a6d70620baa2ce2e3d0ea9b5c76a76debd6dd Mon Sep 17 00:00:00 2001 From: linwenling <3256558519@qq.com> Date: 星期二, 18 七月 2023 17:11:59 +0800 Subject: [PATCH] 家庭收支台账 --- ruoyi-ui/src/views/collection/index.vue | 286 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 215 insertions(+), 71 deletions(-) diff --git a/ruoyi-ui/src/views/collection/index.vue b/ruoyi-ui/src/views/collection/index.vue index 4a1c8c7..9f60459 100644 --- a/ruoyi-ui/src/views/collection/index.vue +++ b/ruoyi-ui/src/views/collection/index.vue @@ -51,11 +51,16 @@ --> </el-form-item> - <el-form-item label="鏃堕棿" style="padding-left:190px"> + <el-form-item label="鏃堕棿"> <el-date-picker v-model="dateRange" - style="width: 240px" - value-format="yyyy-MM-dd HH-MM" + style="width: 197px; + height: 30px; + background: #FFFFFF; + border-radius: 14px 14px 14px 14px; + opacity: 0.5; + border: 1px solid rgba(0,0,0,0.25);" + value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="寮�濮嬫棩鏈�" @@ -63,25 +68,30 @@ ></el-date-picker> </el-form-item> - <el-form-item label="绫诲埆" prop="type" > - <el-input + <el-form-item label="绫诲埆" prop="type"> + <el-select v-model="queryParams.type" - placeholder="璇疯緭鍏ョ被鍒�" + placeholder="鎵�鏈夌被鍒�" clearable style="width: 240px" - @keyup.enter.native="handleQuery"> - <i slot="prefix" class="el-input__icon el-icon-search"></i> - </el-input> + @keyup.enter.native="handleQuery" + > + <el-option + v-for="item in typeOptions" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> </el-form-item> <el-cntainer> <el-col :span="9" > <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" style=" width: 65px; height: 32px;background: #FFDDE3; - border-radius: 6px 6px 6px 6px;opacity:1; " @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" style=" width: 65px; height: 32px;background: #FFDDE3; - border-radius: 6px 6px 6px 6px;opacity:1; " @click="resetQuery">閲嶇疆</el-button> - + <el-button size="mini" @click="handleQuery" style=" width: 67px;height: 27px;background: #FFDDE3; + border-radius: 7px 7px 7px 7px;opacity: 1; " >鎼滅储</el-button> + <el-button size="mini" @click="resetQuery" style=" width: 67px;height: 27px;background: #FFDDE3; + border-radius: 7px 7px 7px 7px;opacity: 1; ">閲嶇疆</el-button> </el-form-item> </el-col> </el-cntainer> @@ -109,14 +119,14 @@ </el-form> <div> - <div style="width: 100px; - height: 24px; - font-size: 18px; - font-family: Microsoft YaHei-Regular, Microsoft YaHei; - font-weight: 400; - color: #000000; - line-height: 21px; - ">鏀惰棌鍜岃崳瑾�</div> +<!-- <div style="width: 100px;--> +<!-- height: 24px;--> +<!-- font-size: 18px;--> +<!-- font-family: Microsoft YaHei-Regular, Microsoft YaHei;--> +<!-- font-weight: 400;--> +<!-- color: #000000;--> +<!-- line-height: 21px;--> +<!-- ">鏀惰棌鍜岃崳瑾�</div>--> <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> @@ -151,42 +161,84 @@ v-hasPermi="['family:note:export']" >瀵煎嚭</el-button> </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExportModel" + 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> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> </div> - <el-table v-loading="loading" :data="collectionList" @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="25" align="center" /> -<!-- <el-table-column label="搴忓彿" prop="id" sortable width="80" />--> + <el-table v-loading="loading" :data="collectionList" :row-key="getRowId" ref="multipleTable" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" style="background: #FFEFF2; border-radius: 14px 14px 14px 14px;"> + <el-table-column type="selection" :reserve-selection="true" width="25" align="center" /> + <el-table-column fixed label="搴忓彿" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="60"/> <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="type" sortable :show-overflow-tooltip="true" width="90" align="center"> - <template slot-scope="scope">{{scope.row.type? scope.row.type: '鈥斺�斺�斺��'}}</template> + <el-table-column label="绫诲埆" prop="type" sortable width="120" align="center"> + <template slot-scope="scope">{{ getSrc(scope.row.type) }}</template> +<!-- <template slot-scope="scope">{{scope.row.type? scope.row.type: '鈥斺�斺�斺��'}}</template>--> </el-table-column> - <el-table-column label="鍚嶇О" prop="name" sortable :show-overflow-tooltip="true" width="90" align="center" > + <el-table-column label="鍚嶇О" prop="name" sortable :show-overflow-tooltip="true" width="120" align="center" > <template slot-scope="scope">{{scope.row.name? scope.row.name: '鈥斺�斺�斺��'}}</template> </el-table-column> - <el-table-column label="鏉ユ簮" prop="source" sortable width="90" align="center" > + <el-table-column label="鏉ユ簮" prop="source" sortable width="120" align="center" > <template slot-scope="scope">{{scope.row.source? scope.row.source: '鈥斺�斺�斺��'}}</template> </el-table-column> - <el-table-column label="鎷ユ湁鑰�" prop="owner" sortable width="110" align="center"> + + <el-table-column label="鎸佹湁鑰�" prop="owner" sortable width="110" align="center"> + <template slot-scope="scope">{{scope.row.owner? scope.row.owner: '鈥斺�斺�斺��'}}</template> </el-table-column> - <el-table-column label="浠峰��" prop="price" sortable width="90" align="center"> + <el-table-column label="浠峰��" prop="price" sortable width="120" align="center"> <template slot-scope="scope">{{scope.row.price? scope.row.price: '鈥斺�斺�斺��'}}</template> </el-table-column> - <el-table-column label="瀛樻斁浣嶇疆" prop="location" sortable width="130" align="center"> + <el-table-column label="瀛樻斁浣嶇疆" prop="location" sortable width="160" align="center"> <template slot-scope="scope">{{scope.row.location? scope.row.location: '鈥斺�斺�斺��'}}</template> </el-table-column> - <el-table-column label="鐢靛瓙鏂囦欢" prop="url" align="center" sortable width="110" > - <template slot-scope="scope"> - <span v-if= "scope.row.url == ','" ><img src="../../assets/images/鏂囦欢澶�-0.png" /></span> - <span v-else><img src="../../assets/images/鏂囦欢澶�-1.png" /></span> - </template> - </el-table-column> - - <el-table-column label="澶囨敞" prop="remark" sortable width="140" align="center"> + <el-table-column label="澶囨敞" prop="remark" sortable width="90" align="center"> <template slot-scope="scope">{{scope.row.remark? scope.row.remark: '鈥斺�斺�斺��'}}</template> + </el-table-column> + <el-table-column label="鐢靛瓙鏂囦欢" prop="url" width="180" align="center"> + + <template slot-scope="scope" > + <div @click="handleCheck(scope.row)"> + <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 === ','" + ></div> + </template> </el-table-column> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" > <template slot-scope="scope" v-if="scope.row.roleId !== 1"> @@ -208,12 +260,13 @@ size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']"> -<!-- <el-button--> -<!-- size="mini"--> -<!-- type="text"--> -<!-- icon="el-icon-d-arrow-right"--> -<!-- @click="handleCheck(scope.row)"--> -<!-- >鏌ョ湅璇︽儏</el-button>--> + <el-button + size="mini" + type="text" + icon="el-icon-d-arrow-right" + @click="handleCheck(scope.row)" + + >鏌ョ湅璇︽儏</el-button> </el-dropdown> </template> @@ -225,18 +278,24 @@ :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" + style="background: #FEF7FC;" @pagination="getList" /> <!-- 娣诲姞鏀惰棌涓庤崳瑾変俊鎭厤缃璇濇 --> <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="happenTime">--> +<!-- <el-input v-model="formDat.happenTime" placeholder="璇疯緭鍏ヨ幏寰楁椂闂�" clearable :style="{width: '100%'}" ></el-input>--> +<!-- </el-form-item>--> <el-form-item label="鑾峰緱鏃堕棿" prop="happenTime"> - <el-input v-model="formDat.happenTime" placeholder="璇疯緭鍏ヨ幏寰楁椂闂�" clearable :style="{width: '100%'}" ></el-input> + <el-date-picker v-model='formDat.happenTime' type='date' placeholder='閫夋嫨鏃ユ湡'></el-date-picker> </el-form-item> <el-form-item label="绫诲埆" prop="type"> - <el-input v-model="formDat.type" placeholder="璇疯緭鍏ョ被鍒�" clearable :style="{width: '100%'}" > - </el-input> + <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="name"> <el-input v-model="formDat.name" placeholder="璇疯緭鍏ュ悕绉�" clearable :style="{width: '100%'}" > @@ -246,8 +305,8 @@ <el-input v-model="formDat.source" placeholder="璇疯緭鍏ユ潵婧�" clearable :style="{width: '100%'}" > </el-input> </el-form-item> - <el-form-item label="鎷ユ湁鑰�" prop="owner"> - <el-input v-model="formDat.owner" placeholder="璇疯緭鍏ユ嫢鏈夎��" clearable :style="{width: '100%'}" > + <el-form-item label="鎸佹湁鑰�" prop="owner"> + <el-input v-model="formDat.owner" placeholder="璇疯緭鍏ユ寔鏈夎��" clearable :style="{width: '100%'}" > </el-input> </el-form-item> <el-form-item label="浠锋牸" prop="price"> @@ -343,7 +402,9 @@ //瀵煎叆鎺ュ彛鍑芥暟 -import {listCollection, getCollection, addCollection,updateCollection, delCollection,uploadPic} from "@/api/collection/index"; +import {listCollection, getCollection, addCollection,updateCollection, delCollection,uploadPic,downloadModel} from "@/api/collection/index"; +import {enload} from "@/api/doctor"; +import {Message} from "element-ui"; export default { @@ -416,7 +477,7 @@ type:undefined, owner:undefined, location:undefined, - happenTime:undefined, + // happenTime:undefined, }, // searchVal:"", @@ -435,8 +496,8 @@ trigger: 'blur' }], happenTime: [{ - // required: true, - message: '璇疯緭鍏ユ椂闂�', + required: true, + message: '璇烽�夋嫨鏃堕棿', trigger: 'blur' }], name: [{ @@ -451,7 +512,7 @@ }], owner: [{ required: true, - message: '璇疯緭鍏ユ嫢鏈夎��', + message: '璇疯緭鍏ユ寔鏈夎��', trigger: 'blur' }], price: [{ @@ -471,12 +532,35 @@ trigger: 'blur' }], }, - typeOptions: [], + typeOptions: [ + { + value: '閭エ', + label: '閭エ' + }, { + value: '鏃ユ湰鍐涘垁', + label: '鏃ユ湰鍐涘垁' + }, { + value: '鑼呭彴閰�', + label: '鑼呭彴閰�' + }, { + value: '绾㈡湪', + label: '绾㈡湪' + }, { + value: '绾康鍝�', + label: '绾康鍝�' + }, { + value: '鐡峰櫒', + label: '鐡峰櫒' + }, { + value: '涔︾睄', + label: '涔︾睄' + } + ], }; }, created() { this.getList(); - // this.getCateInfor() + this.getCateInfor() // for (let i = 0; i < this.contactList.length; i++) { // this.formDat[i] = this.contactList[i]; // } @@ -487,7 +571,10 @@ this.open = false; this.reset(); }, - + getRowId(row) + { + return row.id + }, //闅旇鍙樿壊 tableRowClassName({ row, rowIndex }) { if (rowIndex % 2 == 0) { @@ -499,7 +586,10 @@ /** 鏌ヨ璁板綍鍒楄〃 */ getList() { this.loading = true; - // console.log(this.queryParams) + console.log(this.queryParams) + this.queryParams.happenStartTime = this.dateRange.length > 0 && this.dateRange[0] + this.queryParams.happenEndTime = this.dateRange.length > 0 && this.dateRange[1] + // listProperty(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listCollection(this.queryParams).then(response => { // alert(123) @@ -512,17 +602,36 @@ ); }, /** 鏌ヨ绫诲埆淇℃伅 */ - // getCateInfor() - // { - // 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]}) - // }) - // }) - // }, + getCateInfor() + { + 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]}) + }) + }) + }, + //绫诲埆閫夋嫨 + getSrc(type) { + if (type === '閭エ') { + return '閭エ' + }else if(type === '鏃ユ湰鍐涘垁'){ + return '鏃ユ湰鍐涘垁' + }else if(type === '鑼呭彴閰�'){ + return '鑼呭彴閰�' + }else if(type === '绾㈡湪'){ + return '绾㈡湪' + }else if(type === '绾康鍝�'){ + return '绾康鍝�' + }else if(type === '鐡峰櫒'){ + return '鐡峰櫒' + }else if(type === '涔︾睄'){ + return '涔︾睄' + } else { + return '鍏跺畠' + } + }, handleRemove(file) { alert(323) }, @@ -596,6 +705,7 @@ handleCheck(row){ const id = row.id; this.$router.push("/familymodel/collection/collectionInfo/" + id); + }, /** 淇敼鎸夐挳鎿嶄綔 */ handleUpdate(row) { @@ -635,6 +745,10 @@ }); } }); + // 娓呯┖formDat瀵硅薄鐨勬暟鎹� + Object.keys(this.formDat).forEach(key => { + this.formDat[key] = ''; + }); }, requestUpload(params) { @@ -662,7 +776,7 @@ /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const Ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎缂栧彿涓�"' + Ids + '"鐨勬暟鎹」锛�').then(function() { + this.$modal.confirm('鏄惁纭鍒犻櫎鏁版嵁椤癸紵').then(function() { return delCollection(Ids); }).then(() => { this.getList(); @@ -671,9 +785,39 @@ }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { + const Ids = this.ids; + + if(Ids.length==0) + { this.download('zfCollection/export', { ...this.queryParams }, `zfCollection_${new Date().getTime()}.xlsx`) + }else{ + this.download('zfCollection/export1/'+Ids, { + }, `zfCollection_${new Date().getTime()}.xlsx`) + } + }, + + /** 瀵煎叆妯℃澘涓嬭浇鎸夐挳鎿嶄綔 */ + handleExportModel() { + + this.download('/zfCollection/model', { + }, `zfCollection_model_${new Date().getTime()}.xlsx`) + }, + + /** 瀵煎叆鎿嶄綔*/ + handleEnport(params){ + var file = params.file; + var formData = new FormData(); + formData.append('excelImport', file); + let _this = this + + enload(formData).then(response => { + _this.getList(); + Message({ message: "瀵煎叆鎴愬姛", type: 'warning' }) + + }).catch(() => { Message({ message: "瀵煎叆澶辫触", type: 'error' })}); + } } }; -- Gitblit v1.9.1