<template>
|
<div class="app-container">
|
<div class="form-header mt">
|
<h4 class="dt h4">百年心愿详细信息 </h4>
|
<!-- <el-button v-if="isShow" type="primary" class="pt" icon="el-icon-edit" @click="handleEdit()" >编辑</el-button>-->
|
<!-- <br>-->
|
<!-- <el-button type="primary" class="pt" @click="handleExport"-->
|
<!-- v-hasPermi="['self:user:export']" >导出</el-button>-->
|
</div>
|
<div style="padding-left:15px">
|
<el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-position="left" label-width="120px">
|
<!-- <el-form-item label="id" prop="id">-->
|
<!-- <el-input v-model="formData.id" placeholder="请输入id" :maxlength="11" show-word-limit :disabled="true"-->
|
<!-- clearable prefix-icon='el-icon-mobile' :style="{width: '100%'}"></el-input>-->
|
<!-- </el-form-item>-->
|
<el-container>
|
<el-row :span="12">
|
<el-cow >
|
<el-form-item label="时间" prop="happenTime" label-width="70px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<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="happenTime" label-width="78px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">-->
|
<!-- <el-date-picker v-model='formData.happenTime' type='date' placeholder='请选择日期'></el-date-picker>-->
|
<!-- </el-form-item>-->
|
</el-cow>
|
<el-cow >
|
<el-form-item label="理想标题" prop="title" label-width="100px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<el-input v-model="formData.title" placeholder="请输入理想标题或百年心愿" clearable :style="{width: '100%'}" :disabled="dsb">
|
</el-input>
|
</el-form-item>
|
</el-cow>
|
|
<el-cow >
|
<el-form-item label="始于何因" prop="cause" label-width="100px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<el-input v-model="formData.cause" placeholder="请输入原因" clearable :style="{width: '100%'}" :disabled="dsb">
|
</el-input>
|
</el-form-item>
|
</el-cow>
|
<el-cow >
|
<el-form-item label="受惠人" prop="beneficiary" label-width="80px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<el-input v-model="formData.beneficiary" placeholder="请输入受惠人" clearable :style="{width: '100%'}" :disabled="dsb">
|
</el-input>
|
</el-form-item>
|
</el-cow>
|
<el-cow >
|
<el-form-item label="继承人" prop="heir" label-width="80px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<el-input v-model="formData.heir" placeholder="请输入继承人" clearable :style="{width: '100%'}" :disabled="dsb">
|
</el-input>
|
</el-form-item>
|
</el-cow>
|
<el-cow >
|
<el-form-item label="实现难度" prop="difficulty" label-width="80px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<el-input v-model="formData.difficulty" placeholder="请输入实现难度" clearable :style="{width: '100%'}" :disabled="dsb">
|
</el-input>
|
</el-form-item>
|
</el-cow>
|
<el-cow >
|
<el-form-item label="是否依旧有效" prop="isEffective" label-width="100px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<el-select v-model="formData.isEffective" placeholder="请选择是否依旧有效" clearable :style="{width: '100%'}" :disabled="dsb">
|
<el-option v-for="(item, index) in typeOptions" :key="index" :label="item.label" :value="item.value"
|
></el-option>
|
</el-select>
|
</el-form-item>
|
</el-cow>
|
<el-cow >
|
<el-form-item label="备注" prop="remark" label-width="45px" style="background: #FAD1E0;border-radius: 7px 7px 7px 7px;opacity: 1;">
|
<el-input v-model="formData.remark" placeholder="请输入备注" clearable :style="{width: '100%'}" :disabled="dsb"></el-input>
|
</el-form-item>
|
</el-cow>
|
</el-row>
|
</el-container>
|
<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">正在上传...</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">正在上传...</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>
|
</div>
|
|
<el-dialog :visible.sync="dialogVisible">
|
<img w-full :src="dialogImageUrl" style="width: 700px; height: 700px" alt="Preview Image" />
|
</el-dialog>
|
|
|
</div>
|
</template>
|
|
<script>
|
|
import {blobValidate} from "@/utils/ruoyi";
|
import errorCode from "@/utils/errorCode";
|
import {Message} from "element-ui";
|
import {getWish, updateWish,download,uploadPic} from "@/api/wish/index";
|
|
export default {
|
components: {},
|
props: [],
|
data() {
|
return {
|
cdi:"百年心愿详细信息",
|
udi:"百年心愿信息详情",
|
fot:[".jpg",".jif"],
|
fileList:[
|
],
|
fileListOther:[
|
|
],
|
dsb:true,
|
btn:false,
|
isShow:true,
|
uploading: false,
|
// 百年心愿表格数据
|
wishList: [],
|
|
formData: {
|
//百年心愿记录
|
id:undefined,
|
happenTime:undefined,
|
title:undefined,
|
cause:undefined,
|
beneficiary:undefined,
|
heir:undefined,
|
difficulty:undefined,
|
isEffective:undefined,
|
remark:undefined,
|
url: undefined,
|
},
|
dialogImageUrl: '',
|
dialogVisible: false,
|
disabled: false,
|
rules: {
|
title: [{
|
required: true,
|
message: '请输入理想标题或百年心愿',
|
trigger: 'blur'
|
}],
|
happenTime: [{
|
required: true,
|
message: '请选择时间',
|
trigger: 'blur'
|
}],
|
cause: [{
|
required: true,
|
message: '请输入原因',
|
trigger: 'blur'
|
}],
|
beneficiary: [{
|
required: true,
|
message: '请输入受惠人',
|
trigger: 'blur'
|
}],
|
heir: [{
|
required: true,
|
message: '请输入继承人',
|
trigger: 'blur'
|
}],
|
difficulty: [{
|
// required: true,
|
message: '请输入实现难度',
|
trigger: 'blur'
|
}],
|
|
remark: [{
|
// required: true,
|
message: '请输入备注',
|
trigger: 'blur'
|
}],
|
},
|
typeOptions: [{
|
value: '1',
|
label: '是',
|
},
|
{
|
value: '0',
|
label: '否',
|
}],
|
}
|
},
|
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
|
document.title = "修改百年心愿详细信息";
|
this.$route.meta.title = "修改百年心愿详细信息";//列表的名称
|
}
|
else{
|
document.title = "百年心愿详细信息";
|
this.$route.meta.title = "百年心愿详细信息";//列表的名称
|
this.isShow=false
|
}
|
|
let _this = this
|
if (id) {
|
this.loading = true;
|
getWish({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;
|
});
|
// this.getCateInfor()
|
|
}
|
},
|
mounted() {},
|
methods: {
|
/** 查询类别信息 */
|
// 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]})
|
// })
|
// })
|
// },
|
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) {
|
updateWish(this.formData).then(response => {
|
this.$modal.msgSuccess("修改成功");
|
// this.open = false;
|
this.btn=false
|
});
|
} else {
|
this.$modal.msgSuccess("修改失败");
|
|
}
|
}
|
})
|
},
|
resetForm() {
|
this.$refs['elForm'].resetFields()
|
},
|
// //返回上一页
|
// goBack(){
|
// this.$router.push("/familymodel/collection/index" );
|
// },
|
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);
|
}
|
},
|
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,"")};
|
|
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
|
this.isShow=false
|
},
|
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.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})
|
|
}
|
})
|
|
},
|
|
/** 导出按钮操作 */
|
handleExport() {
|
this.download('/zIdea/export', {
|
...this.queryParams
|
}, `zIdea_${new Date().getTime()}.xlsx`)
|
}
|
|
}
|
}
|
|
</script>
|
|
<style scoped>
|
.app-container{
|
background-color: #FEF7FC;
|
}
|
.mt
|
{
|
position: relative;
|
}
|
.dt{
|
display: block;
|
|
}
|
.pt{
|
right: 10px;
|
top:-3px;
|
display: block;
|
position: absolute;
|
}
|
.form_item{
|
font-size: 12px;
|
font-family: Microsoft YaHei-Regular, Microsoft YaHei;
|
font-weight: 400;
|
color: #000000;
|
}
|
</style>
|