From ba911169712067ed25e6c757cc5a2b5b4e0ea670 Mon Sep 17 00:00:00 2001 From: linwenling <3256558519@qq.com> Date: 星期四, 24 八月 2023 22:37:48 +0800 Subject: [PATCH] 魅宠 --- ruoyi-ui/src/api/pet/index.js | 35 + ruoyi-ui/src/views/pet/petnote.vue | 615 ++++++++++++++++++++++++++ ruoyi-ui/src/views/pet/petInfo.vue | 136 +++-- ruoyi-ui/src/views/pet/index.vue | 145 +++-- ruoyi-ui/src/router/index.js | 36 + ruoyi-ui/src/views/pet/noteInfo.vue | 394 +++++++++++++++++ 6 files changed, 1,249 insertions(+), 112 deletions(-) diff --git a/ruoyi-ui/src/api/pet/index.js b/ruoyi-ui/src/api/pet/index.js index f23068b..ae4a9c8 100644 --- a/ruoyi-ui/src/api/pet/index.js +++ b/ruoyi-ui/src/api/pet/index.js @@ -46,10 +46,10 @@ //榄呭疇澶囧繕褰� -// 鏌ヨ鎵�鏈夐瓍瀹犲蹇樺綍璁板綍 +// 鏍规嵁榄呭疇id 鏌ヨ鎵�鏈夊蹇樻湰 export function listPetnote(query) { return request({ - url: '/family/zfPetNote/all', + url: '/family/zfPetNote', method: 'get', params: query }) @@ -75,15 +75,42 @@ // 鍒犻櫎榄呭疇澶囧繕褰曡褰� export function delPetnote(Ids) { return request({ - url: '/zfPet/' + Ids, + url: '/family/zfPetNote/' + Ids, method: 'delete' }) } //淇敼榄呭疇澶囧繕褰曡褰� export function updatenotePet(data) { return request({ - url: '/zfPet', + url: '/family/zfPetNote', method: 'put', data: data }) } + + +//涓婁紶鏂囦欢 +export function uploadPic(data) { + return request({ + url: '/common/upload', + method: 'post', + data: data + }) +} +//涓嬭浇鏂囦欢 +export function download(data) { + return request({ + url: '/common/downLoadFile', + method: 'get', + params: data, + responseType: 'blob' + }) +} +//瀵煎叆 +export function enload(pid) { + return request({ + url: '/zfPetNote/importData/' + pid, + method: 'post', + data: data + }) +} diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index fddc8d5..f453471 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -276,13 +276,47 @@ children: [ { - path: 'petInfo/:pid(\\d+)', + path: 'petInfo/:id(\\d+)', component: () => import('@/views/pet/petInfo'), name: 'petInfo', meta: { title: '榄呭疇璇︾粏淇℃伅',activeMenu: '/familymodel/zfPetNote'} } ] }, + //榄呭疇澶囧繕鏈� + { + path: '/familymodel/pet', + component: Layout, + // permissions: [], + hidden: true, + permissions: ['familymodel:pet:petnote'], + + children: [ + { + path: 'petnote/:id(\\d+)', + component: () => import('@/views/pet/petnote'), + name: 'petnote', + meta: { title: '榄呭疇澶囧繕鏈�',activeMenu: '/familymodel/zfPetNote'} + } + ] + }, + //榄呭疇澶囧繕鏈鎯� + { + path: '/familymodel/pet', + component: Layout, + // permissions: [], + hidden: true, + permissions: ['familymodel:pet:noteInfo'], + + children: [ + { + path: 'noteInfo/:id(\\d+)', + component: () => import('@/views/pet/noteInfo'), + name: 'petnote', + meta: { title: '澶囧繕鏈鎯�',activeMenu: '/familymodel/zfPetNote'} + } + ] + }, //瀹跺涵灏忓尰鐢� { path: '/familymodel/Doctor', diff --git a/ruoyi-ui/src/views/pet/index.vue b/ruoyi-ui/src/views/pet/index.vue index 9b5ea7e..d374cd3 100644 --- a/ruoyi-ui/src/views/pet/index.vue +++ b/ruoyi-ui/src/views/pet/index.vue @@ -223,11 +223,10 @@ <el-upload action="#" list-type="picture-card" - multiple + :limit="1" :http-request="requestUpload" - :file-list="fileList" + :file-list="fileList1" > -<!-- <div v-if="uploading" class="upload-status">姝e湪涓婁紶...</div>--> <i slot="default" class="el-icon-plus"></i> <div slot="file" slot-scope="{file}"> <img @@ -262,11 +261,10 @@ <el-upload action="#" list-type="picture-card" - multiple - :http-request="requestUpload" - :file-list="fileListOther" + :limit="1" + :http-request="requestUpload2" + :file-list="fileList2" > -<!-- <div v-if="uploading" class="upload-status">姝e湪涓婁紶...</div>--> <i slot="default" class="el-icon-plus"></i> <div slot="file" slot-scope="{file}"> <img @@ -293,8 +291,6 @@ <i class="el-icon-delete"></i> </span> </span> - - </div> </el-upload> </el-form> @@ -343,7 +339,7 @@ showSearch: true, // 鎬绘潯鏁� total: 0, - // 璧勪骇琛ㄦ牸鏁版嵁 + petList: [], // 寮瑰嚭灞傛爣棰� title: "", @@ -359,14 +355,11 @@ dateRange: [], // 鏁版嵁鑼冨洿閫夐」 fot:[".jpg",".jif"], - fileList:[ - ], - fileListOther:[ - - ], + fileList1:[ ], + fileList2:[ ], + fileListOther:[ ], dsb:true, btn:false, - uploading: false, formDat: { type: undefined, name: undefined, @@ -389,7 +382,8 @@ diseatHabit: undefined, LifeHabit: undefined, disLifeHabit: undefined, - url: undefined, + headPicture:undefined, + fullPicture:undefined, }, petList: { @@ -408,6 +402,8 @@ LifeHabit: undefined, disLifeHabit: undefined, url: undefined, + headPicture:undefined, + fullPicture:undefined, }, // 鑿滃崟鍒楄〃 @@ -445,7 +441,7 @@ trigger: 'blue' }], securityCode: [{ - required: true, + // required: true, message: '璇疯緭鍏ラ槻浼爜', trigger: 'blue' }], @@ -465,7 +461,7 @@ trigger: 'blue' }], properties: [{ - required: true, + // required: true, message: '璇疯緭鍏ユ�ц川', trigger: 'blue' }], @@ -476,13 +472,13 @@ }], LifeHabit: [{ - required: true, + // required: true, message: '璇疯緭鍏ョ敓娲讳範鎯�(鍠�)', trigger: 'blur' }], disLifeHabit: [{ - required: true, + // required: true, message: '璇疯緭鍏ョ敓娲讳範鎯�(鎭�)', trigger: 'blur' }], @@ -498,6 +494,27 @@ message: '璇疯緭鍏ラギ椋熶範鎯�(鍠�)', trigger: 'blur' }], + masterName: [{ + required: true, + message: '璇疯緭鍏ヤ富浜哄鍚�', + trigger: 'blur' + }], + masterIdNum: [{ + required: true, + message: '璇疯緭鍏ヤ富浜鸿韩浠借瘉鍙风爜', + trigger: 'blur' + }], + phone: [{ + required: true, + message: '璇疯緭鍏ユ墜鏈哄彿', + trigger: 'blur' + }], + masterAddress: [{ + required: true, + message: '璇疯緭鍏ヤ富浜哄湴鍧�', + trigger: 'blur' + }], + }, @@ -516,6 +533,8 @@ }, methods: { + + // 鍙栨秷鎸夐挳 cancelData() { this.open = false; @@ -660,31 +679,33 @@ }); }, - + //鏀惧ぇ handlePictureCardPreview(file) { this.dialogImageUrl = file.url; this.dialogVisible = true; }, + /** 鎻愪氦鎸夐挳锛堟暟鎹潈闄愶級 */ submitDataScope: function() { - let ul = this.fileList.map(function (elem){ + let ul = this.fileList1.map(function (elem){ return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") }).join(",") - let uls = this.fileListOther.map(function (elem){ + let uls = this.fileList2.map(function (elem){ return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") }).join(",") - this.formDat.url = ul+","+uls - this.$refs["elForm"].validate(valid => { - if (valid) { + this.formDat.headPicture = ul, + this.formDat.fullPicture = uls, + this.$refs["elForm"].validate(valid => { + if (valid) { - addPet(this.formDat).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - }); + addPet(this.formDat).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + }); // 娓呯┖formDat瀵硅薄鐨勬暟鎹� Object.keys(this.formDat).forEach(key => { this.formDat[key] = ''; @@ -696,23 +717,31 @@ { var file = params.file; var formData = new FormData(); + formData.append('uploadFile', file); let _this = this - this.uploading = true; + uploadPic(formData).then(response => { let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length) - this.uploading = false; - this.$modal.msgSuccess("涓婁紶鎴愬姛"); - if(_this.fot.includes(pth) === true) - { - _this.fileList.push({name:response.data.fileName, "url":response.data.url}) + _this.fileList1.push({name:response.data.fileName, url:response.data.url}) + // _this.fileList2.push({name:response.data.fileName, url:response.data.url}) + console("ok") + }) - } + }, + requestUpload2(params) + { + var file = params.file; + var formData = new FormData(); - else{ - _this.fileListOther.push({name:response.data.fileName, url:response.data.url}) + 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) + // _this.fileList1.push({name:response.data.fileName, url:response.data.url}) + _this.fileList2.push({name:response.data.fileName, url:response.data.url}) + console("ok") }) }, @@ -726,29 +755,15 @@ this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); }).catch(() => {}); }, + + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { this.download('family/pet/export', { ...this.queryParams }, `pet_${new Date().getTime()}.xlsx`) }, - /** 瀵煎叆鎿嶄綔*/ - handleEnport(params){ - var file = params.file; - var formData = new FormData(); - formData.append('excelImport', file); - let _this = this - alert(file) - enload(formData).then(response => { - _this.getList(); - Message({ message: "瀵煎叆鎴愬姛", type: 'warning' }) - }).catch(err) - { - Message({ message: "瀵煎叆澶辫触", type: 'error' }) - } - - } } }; </script> @@ -761,4 +776,14 @@ background: #FFEFF2; } +.upload-demo .el-upload-list__item-thumbnail img { + width: 100%; + height: 100%; + object-fit: cover; +} +.upload-demo .el-icon-plus { + font-size: 28px; + color: #999; + border: 1px dashed #999; +} </style> diff --git a/ruoyi-ui/src/views/pet/noteInfo.vue b/ruoyi-ui/src/views/pet/noteInfo.vue new file mode 100644 index 0000000..8de0eef --- /dev/null +++ b/ruoyi-ui/src/views/pet/noteInfo.vue @@ -0,0 +1,394 @@ +<template> + <div class="app-container"> + <div class="form-header mt"> + <h1 style="font-size:21px;padding-top:30px;display: flex;justify-content: space-between;align-items: center;"> + <span>澶囧繕褰曡鎯�</span> + + </h1> + </div> + + <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px"> + + <el-form-item label="鏃ユ湡" prop="happenTime" > + <el-input v-model="formData.happenTime" placeholder="璇疯緭鍏ユ椂闂�" type="date" 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 label="鎻愰啋鏃堕棿" prop="remindTime" > + <el-input v-model="formData.remindTime" placeholder="璇疯緭鍏ユ椂闂�" type="date" clearable :style="{width: '100%'}" :disabled="dsb"> + </el-input> + </el-form-item> + <el-form-item label="澶囨敞" prop="remark"> + <el-input v-model="formData.remark" placeholder="璇疯緭鍏ュ娉�" clearable :style="{width: '100%'}" :disabled="dsb"></el-input> + </el-form-item> + + <h4 class="form-header">鐢靛瓙鏂囦欢 </h4> + <el-upload + action="#" + list-type="picture-card" + multiple + :http-request="requestUpload" + :file-list="fileList" + > + <div v-if="uploading" class="upload-status">姝e湪涓婁紶...</div> + <i v-if="!uploading" slot="default" class="el-icon-plus"></i> + <div slot="file" slot-scope="{file}"> + <img + class="el-upload-list__item-thumbnail" + :src="file.url" + alt="" + style="width: 147px; height: 147px" + fit="cover" + :preview-src-list="[file.url]" + > + <span class="el-upload-list__item-actions"> + <span + + class="el-upload-list__item-preview" + @click="handlePictureCardPreview(file)" + > + <i class="el-icon-zoom-in"></i> + </span> + <span + + class="el-upload-list__item-delete" + @click="handleDownload(file.url)" + > + <i class="el-icon-download"></i> + </span> + <span + v-if="isShow" + class="el-upload-list__item-delete" + @click="handleRemove(file)" + > + <i class="el-icon-delete"></i> + </span> + </span> + + + </div> + </el-upload> + + <h4 class="form-header">鍏朵粬闄勪欢 </h4> + <el-upload + action="" + :file-list="fileListOther" + class="upload-demo" + multiple + list-type="picture-card" + :on-preview="handleFileCardPreview" + :on-remove="handleRemoveFile" + :http-request="requestUpload" + :show-file-list="true" + > + <div v-if="uploading" class="upload-status">姝e湪涓婁紶...</div> + <i v-if="!uploading" 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 + + class="el-upload-list__item-preview" + @click="handleFileCardPreview(file)" + > + <i class="el-icon-zoom-in"></i> + </span> + <span + + class="el-upload-list__item-delete" + @click="handleDownload(file.url)" + > + <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 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 {getPetnoteList, updatenotePet, uploadPic, download} from "@/api/pet/index"; +import {addRole, updateRole} from "@/api/system/role"; +import {blobValidate} from "@/utils/ruoyi"; +import errorCode from "@/utils/errorCode"; +import {Message} from "element-ui"; + +export default { + components: {}, + props: [], + data() { + return { + cdi:"榄呭疇澶囧繕鏈缁嗕俊鎭�", + udi:"榄呭疇澶囧繕鏈俊鎭慨鏀�", + fot:[".jpg",".jif",".png"], + fileList:[ + ], + fileListOther:[ + + ], + dsb:true, + btn:false, + isShow:true, + uploading: false, + formData: { + + type: undefined, + title: undefined, + location: undefined, + holder: undefined, + address: undefined, + remark: undefined, + url: undefined, + }, + desurl:'', + dialogImageUrl: '', + dialogVisible: false, + disabled: false, + rules: { + + type: [{ + required: true, + message: '璇烽�夋嫨绫诲埆', + trigger: 'change' + }], + title: [{ + required: true, + message: '璇疯緭鍏ユ爣棰�', + trigger: 'blur' + }], + location: [{ + required: true, + message: '璇疯緭鍏ュ瓨鍌ㄥ湴鍧�', + trigger: 'blur' + }], + holder: [{ + required: true, + message: '璇疯緭鍏ユ寔鏈変汉', + trigger: 'blur' + }], + address: [{ + 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=false + } + + let _this = this + if (id) { + this.loading = true; + getPetnoteList(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; + }); + + } + }, + 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) { + updatenotePet(this.formData).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + // this.open = false; + this.btn=false + }); + } else { + this.$modal.msgSuccess("淇敼澶辫触"); + + } + } + }) + }, + resetForm() { + this.$refs['elForm'].resetFields() + }, + 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'); + }, + 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 = 'property_'+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); + } + }, + 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 = 'property_'+nt+'.'+suffix + const blob = new Blob([response]) + saveAs(blob, filename) + }) + }, + handleEdit() + { + this.dsb = false + this.btn = true + }, + + //鏌ョ湅澶囧繕鏈� + checkNote(row){ + // const id =row.id; + const id = this.$route.params && this.$route.params.id; + // const fid =2031 + this.$router.push("/familymodel/property/memo/" + id ); + }, + requestUpload(params) + { + var file = params.file; + var formData = new FormData(); + formData.append('uploadFile', file); + let _this = this + this.uploading = true; + uploadPic(formData).then(response => { + let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length) + this.uploading = false; + this.$modal.msgSuccess("涓婁紶鎴愬姛"); + if(_this.fot.indexOf(pth) !== -1) + { + _this.fileList.push({"name":response.data.fileName, "url":response.data.url}) + } + else{ + _this.fileListOther.push({"name":response.data.fileName, "url":response.data.url}) + } + }) + + } + + } +} + +</script> +<style> +.mt +{ + position: relative; +} +.dt{ + display: block; + +} +.form{ + background:center/11% no-repeat url('../../assets/icons/form.png') ; +} +.pt{ + right: 10px; + top:-3px; + display: block; + position: absolute; +} +</style> diff --git a/ruoyi-ui/src/views/pet/petInfo.vue b/ruoyi-ui/src/views/pet/petInfo.vue index 2646546..bca6fee 100644 --- a/ruoyi-ui/src/views/pet/petInfo.vue +++ b/ruoyi-ui/src/views/pet/petInfo.vue @@ -1,8 +1,18 @@ <template> <div class="app-container"> <div class="form-header mt"> - <h4 class="dt h4">鍩烘湰淇℃伅 </h4> - <el-button type="primary" @click="Petnote(pid)" :disabled="btn">榄呭疇澶囧繕褰�</el-button> + <!-- <h4 class="dt h4">鍩烘湰淇℃伅 </h4> + <el-button type="primary" @click="Petnote(pid)" :disabled="btn">榄呭疇澶囧繕褰�</el-button> --> + <h1 style="font-size:21px;padding-top:30px;display: flex;justify-content: space-between;align-items: center;"> + <span>鍩烘湰淇℃伅</span> + <div style="display: flex; align-items: center;"> + <el-button size="mini" type="text" @click="Petnote(pid)" v-hasPermi="['person:information:memo']"> + <div class="form" ><el-icon style="padding-right:110px;"></el-icon> + <span class="text" style="width: 69px;height: 26px;font-size: 16px; + font-family: Microsoft YaHei-Regular, Microsoft YaHei; color: #EBA4AA;">榄呭疇澶囧繕褰�</span></div> + </el-button> + </div> + </h1> </div> <h2 style="width: 100px;height: 16px;font-size: 15px;font-family: Microsoft YaHei-Regular, Microsoft YaHei;font-weight: 400;color: #000000;line-height: 15px;">鍩烘湰淇℃伅</h2> <el-container > @@ -124,7 +134,7 @@ </el-avatar> </el-col> </div> - + <el-button v-if="isShow" type="primary" @click="submitForm" :disabled="dsb">淇敼榄呭疇淇℃伅</el-button> </el-col> </div> </el-container> @@ -194,12 +204,20 @@ :src="'http://47.93.189.255:8080/'+ petList.fullPicture" :fit="fit" style="width: 100%;height: 100%;border-radius: 0px 0px 0px 0px;opacity: 1;border: 1px solid rgba(0,0,0,0.5);" ></el-image> + <el-upload class="upload-demo" action="/uploadImage" :on-success="handleUploadSuccess"> + <el-button slot="trigger">鐐瑰嚮涓婁紶鏂板浘鐗�</el-button> + </el-upload> + </el-avatar> </el-col> </div> - <el-button v-if="isShow" type="primary" @click="submitForm" :disabled="dsb">淇敼榄呭疇淇℃伅</el-button> + <el-button>淇敼</el-button> </el-col> </div> + + + + <el-dialog :visible.sync="dialogVisible"> <img w-full :src="dialogImageUrl" alt="Preview Image" /> @@ -317,7 +335,7 @@ </div> </template> <script> -import {getPetList, getPetowner, listPetnote,getPetnoteList,uploadPic, download,updatePetowner,updatePet,addPetnote} from "@/api/pet/index"; +import {getPetList, listPetnote,uploadPic, download,updatePet} from "@/api/pet/index"; import {addRole, updateRole} from "@/api/system/role"; import {blobValidate} from "@/utils/ruoyi"; import errorCode from "@/utils/errorCode"; @@ -374,17 +392,7 @@ remark: undefined, url: undefined, }, - petownerList: { - email: undefined, - name: undefined, - certificateType: undefined, - certificateNo: undefined, - fixedNo:undefined, - many:undefined, - phoneNo:undefined, - address: undefined, - property: undefined, - }, + dialogImageUrl: '', dialogVisible: false, disabled: false, @@ -424,7 +432,7 @@ computed: {}, watch: {}, created() { - const id = this.$route.params && this.$route.params.pid; + const id = this.$route.params && this.$route.params.id; this.pid = id; let jd; if(this.$route.query.detail!=undefined) @@ -446,12 +454,13 @@ this.loading = true; getPetList(id).then((response) => { this.petList = response.data; + console.log(this.petList) this.loading = false; }); - getPetowner(id).then((response) => { - this.petownerList = response.data; - this.loading = false; - }); + // getPetowner(id).then((response) => { + // this.petownerList = response.data; + // this.loading = false; + // }); } @@ -470,39 +479,68 @@ listPetnote(this.queryParams).then(response => { // alert(123) // console.log(response.data) - console.log(response.data) this.PetNoteList = response.data.data; - this.total = response.data.total; this.loading = false; } ); }, - 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.petList.url = ul+","+uls + requestUpload(params) + { + var file = params.file; + var formData = new FormData(); - this.$refs['elForm'].validate(valid => { + formData.append('uploadFile', file); + let _this = this - - if (valid) { - if (this.petList.id != undefined) { - updatePet(this.petList).then(response => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - // this.open = false; - this.btn=false - }); - } else { - this.$modal.msgSuccess("淇敼澶辫触"); - - } - } + uploadPic(formData).then(response => { + let pth = response.data.originalFilename.substr(response.data.originalFilename.length-4, response.data.originalFilename.length) + _this.fileList1.push({name:response.data.fileName, url:response.data.url}) + console("ok") }) + + }, + requestUpload2(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) + _this.fileList2.push({name:response.data.fileName, url:response.data.url}) + console("ok") + }) + + }, + submitForm() { + + let ul = this.fileList1.map(function (elem){ + return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") + }).join(",") + let uls = this.fileList2.map(function (elem){ + return elem.url.replace(process.env.VUE_APP_BASE_TRUE_API,"") + }).join(",") + this.petList.headPicture = ul, + this.petList.fullPicture = uls, + this.$refs['elForm'].validate(valid => { + + + if (valid) { + if (this.petList.id != undefined) { + updatePet(this.petList).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + // this.open = false; + this.btn=false + }); + } else { + this.$modal.msgSuccess("淇敼澶辫触"); + + } + } + }) }, @@ -545,8 +583,9 @@ /** 澶囧繕褰� */ Petnote(pid){ - this.openDataScope = true - this.getList() + const id = this.$route.params && this.$route.params.id; + this.$router.push("/familymodel/pet/petnote/" + id ); + }, handlePictureCardPreview(file) { this.dialogFileUrl = file.url; @@ -625,6 +664,9 @@ display: block; } +.form{ + background:center/11% no-repeat url('../../assets/icons/form.png') ; +} .pt{ right: 50px; top:-3px; diff --git a/ruoyi-ui/src/views/pet/petnote.vue b/ruoyi-ui/src/views/pet/petnote.vue index e69de29..7238447 100644 --- a/ruoyi-ui/src/views/pet/petnote.vue +++ b/ruoyi-ui/src/views/pet/petnote.vue @@ -0,0 +1,615 @@ +<template> + <div class="app-container" style="opacity: 1;"> + <div class="box1"><h2>{{name}}鐨勫蹇樻湰</h2></div> + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + plain + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['system:role:add']" + >鏂板</el-button> + </el-col> + + <el-col :span="1.5"> + <el-button + type="danger" + plain + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['system:role:remove']" + >鍒犻櫎</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.5"> + <el-button + type="warning" + plain + icon="el-icon-download" + size="mini" + @click="handleExportTemplate" + 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-row> + <el-table v-loading="loading" :data="PetNoteList" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" style="background: #FFEFF2; border-radius: 14px 14px 14px 14px;width: 100%;"> + <el-table-column type="selection" width="55" align="center" /> + <el-table-column label="搴忓彿" sortable type="index" :index="(queryParams.pageNum-1)*queryParams.pageSize+1" width="80px"/> + <el-table-column label="鏃ユ湡" prop="happenTime" sortable width="200px" align="center"> + <template slot-scope="scope">{{scope.row.happenTime? scope.row.happenTime: '鈥斺�斺�斺��'}}</template> + </el-table-column> + + <el-table-column label="棰樺悕" prop="title" sortable width="120px" /> + <el-table-column label="鎻愰啋鏃堕棿" prop="remindTime" sortable width="200px" align="center"> + <template slot-scope="scope">{{scope.row.remindTime? scope.row.remindTime: '鈥斺�斺�斺��'}}</template> + </el-table-column> + + <el-table-column label="澶囨敞" prop="remark" sortable width="200px" /> + <el-table-column label="鐢靛瓙鏂囦欢" prop="url" width="120px" > + <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 === '' || 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" + + ></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"> + + <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" + class="button_delete" + @click="handleDelete(scope.row)" + v-hasPermi="['system:role:remove']" + > <sapn v-html="'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'"></sapn></el-button> + <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['familymodel:property:info']"> + <el-button size="mini" type="text" icon="el-icon-d-arrow-right" @click="handleCheck(scope.row)">鏌ョ湅璇︽儏</el-button> + </el-dropdown> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + style="background: #FEF7FC;" + /> + + <!-- 娣诲姞鎴栦慨鏀硅祫浜т俊鎭厤缃璇濇 --> + + <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-date-picker + v-model='formDat.happenTime' + type='date' + placeholder='閫夋嫨鏃ユ湡' + ></el-date-picker> + </el-form-item> + + <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="remindTime"> + <el-date-picker + v-model='formDat.remindTime' + type='date' + placeholder='閫夋嫨鏃ユ湡' + ></el-date-picker> + </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 + action="#" + list-type="picture-card" + multiple + :http-request="requestUpload" + :file-list="fileList" + > + <i slot="default" class="el-icon-plus"></i> + <div slot="file" slot-scope="{file}"> + <img + class="el-upload-list__item-thumbnail" + :src="file.url" + alt="" + style="width: 126px; height: 126px" + fit="cover" + :preview-src-list="[file.url]" + > + <span class="el-upload-list__item-actions"> + <span + class="el-upload-list__item-preview" + @click="handlePictureCardPreview(file)" + > + <i class="el-icon-zoom-in"></i> + </span> + + <span + v-if="!disabled" + class="el-upload-list__item-delete" + @click="handleRemove(file)" + > + <i class="el-icon-delete"></i> + </span> + </span> + + + </div> + </el-upload> + <h4 class="form-header">鍏朵粬闄勪欢 </h4> + <el-upload + action="" + :file-list="fileListOther" + class="upload-demo" + multiple + + :on-remove="handleRemoveFile" + :http-request="requestUpload" + :show-file-list="true" + > + <el-button type="primary">鐐瑰嚮涓婁紶</el-button> + <template #tip> + <div class="el-upload__tip"> + </div> + </template> + </el-upload> + + + </el-form> + + <h4 class="form-header"> </h4> + + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitDataScope">纭� 瀹�</el-button> + <el-button @click="cancelData">鍙� 娑�</el-button> + </div> + </el-dialog> + + <!-- 鍒嗛厤瑙掕壊鏁版嵁鏉冮檺瀵硅瘽妗� --> + <el-dialog :title="title" :visible.sync="openDataScope" width="500px" append-to-body> + + </el-dialog> + + </div> +</template> + +<script> +import { listRole, getRole, delRole, addRole, updateRole, dataScope, changeRoleStatus, deptTreeSelect } from "@/api/system/role"; +import { treeselect as menuTreeselect, roleMenuTreeselect } from "@/api/system/menu"; + + + +//鍦╯ystem/note/index.js涓鍏ユ帴鍙e嚱鏁� --鎺ュソ浜� +import {listPetnote,addPetnote,enload,delPetnote,updatenotePet,getPetList, uploadPic} from "@/api/pet/index"; +import { TimeSelect } from "element-ui"; + +export default { + name: "Role", + dicts: ['sys_normal_disable'], + data() { + return { + // 閬僵灞� + name:'', + disabled: false, + loading: true, + formData:[], + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 瀹跺ぇ浜嬭琛ㄦ牸鏁版嵁 + memoList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏄惁鏄剧ず寮瑰嚭灞傦紙鏁版嵁鏉冮檺锛� + openDataScope: false, + menuExpand: false, + menuNodeAll: false, + deptExpand: true, + deptNodeAll: false, + // 鏃ユ湡鑼冨洿 + dateRange: [], + // 鏁版嵁鑼冨洿閫夐」 + fot:[".jpg",".jif"], + fileList:[ + ], + fileListOther:[ + + ], + dsb:true, + btn:false, + PetNoteList:{}, + petList:{}, + formDat: { + fid:undefined, + remindTime:undefined, + url:undefined, + title: undefined, + happenTime: undefined, + }, + // 鑿滃崟鍒楄〃 + menuOptions: [], + // 閮ㄩ棬鍒楄〃 + deptOptions: [], + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + defaultProps: { + children: "children", + label: "label" + }, + // 琛ㄥ崟鏍¢獙 + rules: { + + happenTime: [{ + required: true, + message: '璇烽�夋嫨鏃ユ湡閫夋嫨', + trigger: 'change' + }], + remindTime: [{ + required: true, + message: '璇烽�夋嫨鏃ユ湡閫夋嫨', + trigger: 'change' + }], + title: [{ + required: true, + message: '璇疯緭鍏ュ唴瀹�', + trigger: 'blur' + }], + fid: [{ + required: true, + // message: '璇疯緭鍏ュ唴瀹�', + // trigger: 'blur' + }], + + remark: [{ + // required: true, + message: '璇疯緭鍏ュ娉�', + trigger: 'blur' + }], + + }, + typeOptions: [], + + }; + }, + created() { + + this.getList() + + }, + methods: { + + // 鍙栨秷鎸夐挳 + cancelData() { + this.open = false; + this.reset(); + }, + + //闅旇鍙樿壊 + tableRowClassName({ row, rowIndex }) { + if (rowIndex % 2 == 0) { + return "statistics-warning-row1"; + } else { + return "statistics-warning-row"; + } + }, + + /** 鏌ヨ瑙掕壊鍒楄〃 */ + + getList() { + const id = this.$route.params && this.$route.params.id; + getPetList(id).then(response =>{ + this.name = response.data.name; + }) + const pid = id; + this.loading = true; + listPetnote({pid}).then(response => { + this.PetNoteList = response.data.data; + this.total = response.data.total; + this.loading = false; + }); + + + + + + }, + handleRemove(file) { + for(let i = 0; i < this.fileListOther.length; i++) + { + if(this.fileListOther[i].url==file.url) + this.$delete(this.fileListOther,i); + } + }, + + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + getRowId(row) + { + return row.id + }, + // 鍙栨秷鎸夐挳锛堟暟鎹潈闄愶級 + cancelDataScope() { + this.openDataScope = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + if (this.$refs.menu != undefined) { + this.$refs.menu.setCheckedKeys([]); + } + this.menuExpand = false, + this.menuNodeAll = false, + this.deptExpand = true, + this.deptNodeAll = false, + this.form = { + roleId: undefined, + roleName: undefined, + roleKey: undefined, + roleSort: 0, + status: "0", + menuIds: [], + deptIds: [], + menuCheckStrictly: true, + deptCheckStrictly: true, + remark: undefined + }; + this.resetForm("form"); + }, + + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.id) + console.log(this.ids) + this.single = selection.length!=1 + this.multiple = !selection.length + }, + + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "鏂板澶囧繕鏈�"; + }, + + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + const id = row.id; + let jd = true + this.$router.push({ + path:"/familymodel/pet/noteInfo/" + id, + query:{ + detail:jd + } + }); + }, + /** 鏌ョ湅璇︾粏淇℃伅 */ + handleCheck(row){ + const id = row.id; + this.$router.push("/familymodel/pet/noteInfo/" + id); + }, + + handlePictureCardPreview(file) { + this.dialogImageUrl = file.url; + this.dialogVisible = true; + }, + + /** 鎻愪氦鎸夐挳锛堟暟鎹潈闄愶級 */ + submitDataScope: function() { + const pid = this.$route.params && this.$route.params.id; + 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.formDat.pid = pid; + this.formDat.url = ul+","+uls + this.$refs["elForm"].validate(valid => { + if (valid) { + addPetnote(this.formDat).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); + }); + } + }); + //娓呯┖formDat瀵硅薄鐨勬暟鎹� + Object.keys(this.formDat).forEach(key => { + this.formDat[key] = ''; + }); + }, + 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}) + + } + }) + + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const Ids = row.id || this.ids; + this.$modal.confirm('鏄惁纭鍒犻櫎鎵�閫夋暟鎹」锛�').then(function() { + return delPetnote(Ids); + }).then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }).catch(() => {}); + }, + + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + const pid = this.$route.params && this.$route.params.id; + const queryParams = { + pid: pid, + ...this.queryParams + }; + + if (Object.keys(queryParams).length === 1 && 'pid' in queryParams) { + this.download('/family/zfPetNote/export', queryParams, `zfPetNote_${new Date().getTime()}.xlsx`); + } else { + const Ids = this.ids; + if (Ids.length === 0) { + this.download('/family/zfPetNote/export', this.queryParams, `zfPetNote_${new Date().getTime()}.xlsx`); + } else { + this.download('/family/zfPetNote/export1/' + Ids, {}, `zfPetNote_${new Date().getTime()}.xlsx`); + } + } + }, + //瀵煎叆妯℃澘涓嬭浇 + handleExportTemplate(){ + this.download('/family/zfPetNote/model', { + + }, `PetNote_${new Date().getTime()}.xlsx`) + }, + /** 瀵煎叆鎿嶄綔*/ + handleEnport(params, pid) { + this.pid = this.$route.params && this.$route.params.id; + var file = params.file; + var formData = new FormData(); + formData.append('excelImport', file); + formData.append('pid', pid); // 娣诲姞瀵煎叆鍒板摢涓� ID 鐨勪俊鎭� + console.log(this.pid); + let _this = this; + + enload(formData) + .then(response => { + _this.getList(); + Message({ message: "瀵煎叆鎴愬姛", type: 'warning' }); + }) + .catch(error => { + Message({ message: "瀵煎叆澶辫触", type: 'error' }); + }); + } + }, + + // 寮圭獥 + handleShow(scope){ + + this.openDataScope = true + this.getList() + } + +}; +</script> + +<style> +.el-table__row.statistics-warning-row { + background: #EBFFF2; + +} +.el-table__row.statistics-warning-row1 { + background: #FFEFF2; + +} + +.button1 { + background:center no-repeat url('../../assets/icons/add1.png') ; + /* margin-left: 69.5vw; */ + margin-left: 95%; +} + +.button_delete { + background: center no-repeat url('../../assets/images/鍒犻櫎2.png') ; + + /* margin-left: 66vw; */ + width: 5px; + +} + +.box1,.button1{ + display: inline-block; +} +</style> -- Gitblit v1.9.1