Commit 02fda4ec authored by 黄奎's avatar 黄奎

上传修改

parent 02011c31
...@@ -210,10 +210,11 @@ ...@@ -210,10 +210,11 @@
methods: { methods: {
downLoadPZ: function (src) { downLoadPZ: function (src) {
const link = document.createElement('a'); var a = document.createElement('a')
link.href = src; var event = new MouseEvent('click')
document.body.appendChild(link); a.download = '下载图片名称'
link.click(); a.href = src;
a.dispatchEvent(event)
}, },
stringToArr(str) { stringToArr(str) {
return str.split(',') return str.split(',')
......
...@@ -579,6 +579,7 @@ ...@@ -579,6 +579,7 @@
res => { res => {
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
var tempData = res.data.data; var tempData = res.data.data;
console.log("tempData",tempData);
if (tempData.Feature != null) { if (tempData.Feature != null) {
this.FeatureData.ID = tempData.Feature.ID; this.FeatureData.ID = tempData.Feature.ID;
this.FeatureData.ConfigId = tempData.Feature.ConfigId; this.FeatureData.ConfigId = tempData.Feature.ConfigId;
......
...@@ -1550,7 +1550,7 @@ ...@@ -1550,7 +1550,7 @@
var fileName = `${that.uuid(10,10)}.png`; var fileName = `${that.uuid(10,10)}.png`;
var path = `/feature/${that.cid}/${fileName}`; var path = `/feature/${that.cid}/${fileName}`;
that.uploadBlob(path, newArr, x => { that.uploadBlob(path, newArr, x => {
let allPath=this.domainManager().ViittoFileUrl+x.name; let allPath=that.domainManager().ViittoFileUrl+x.name;
let i=e.target.id.split('_')[2]; let i=e.target.id.split('_')[2];
that.imgUrlChange(allPath) that.imgUrlChange(allPath)
}) })
......
<style> <style>
.pictureRmg .avatar-uploader .el-upload {border: 1px dashed #d9d9d9;border-radius: 6px;cursor: pointer;position: relative;overflow: hidden;} .pictureRmg .avatar-uploader .el-upload {border: 1px dashed #d9d9d9;border-radius: 6px;cursor: pointer;position: relative;overflow: hidden;}
.pictureRmg .avatar-uploader .el-upload:hover {border-color: #409EFF;} .pictureRmg .avatar-uploader .el-upload:hover {border-color: #409EFF;}
.pictureRmg .avatar-uploader-icon {font-size: 28px;color: #8c939d;width: 178px;height: 178px;line-height: 178px;text-align: center;} .pictureRmg .avatar-uploader-icon {font-size: 28px;color: #8c939d;width: 178px;height: 178px;line-height: 178px;text-align: center;}
.pictureRmg .avatar {width: 178px;height: 178px;display: block;} .pictureRmg .avatar {width: 178px;height: 178px;display: block;}
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
.pictureRmg .picturMG img{width: 135px;height: 90px;display: inline-block;margin: 20px auto;} .pictureRmg .picturMG img{width: 135px;height: 90px;display: inline-block;margin: 20px auto;}
</style> </style>
<template> <template>
<div class='flexOne pictureRmg'> <div class='flexOne pictureRmg'>
<div class='query-box'> <div class='query-box'>
<ul> <ul>
<li> <li>
<label class="">{{$t('system.query_airName')}}</label> <label class="">{{$t('system.query_airName')}}</label>
<el-input v-model="msg.Name" :placeholder="$t('system.ph_in')" class="w210"></el-input> <el-input v-model="msg.Name" :placeholder="$t('system.ph_in')" class="w210"></el-input>
</li> </li>
<!-- <li> <!-- <li>
<label class="">{{$t('admin.admin_status')}}</label> <label class="">{{$t('admin.admin_status')}}</label>
<el-select v-model="msg.Country_id" :placeholder="$t('system.ph_choice')"> <el-select v-model="msg.Country_id" :placeholder="$t('system.ph_choice')">
<el-option key="1" label="全部" value="1"></el-option> <el-option key="1" label="全部" value="1"></el-option>
...@@ -25,272 +25,271 @@ ...@@ -25,272 +25,271 @@
<el-option key="3" label="删除" value="3"></el-option> <el-option key="3" label="删除" value="3"></el-option>
</el-select> </el-select>
</li> --> </li> -->
<li> <li>
<label class="">{{$t('admin.admin_type')}}</label> <label class="">{{$t('admin.admin_type')}}</label>
<el-select v-model="msg.Type" :placeholder="$t('system.ph_choice')" class="w210"> <el-select v-model="msg.Type" :placeholder="$t('system.ph_choice')" class="w210">
<el-option :label="$t('pub.unlimitedSel')" value='-1'></el-option> <el-option :label="$t('pub.unlimitedSel')" value='-1'></el-option>
<el-option v-for='item in PicTypeList' <el-option v-for='item in PicTypeList' :key="item.Id" :label="item.Name" :value="item.Id">
:key="item.Id" </el-option>
:label="item.Name" </el-select>
:value="item.Id"> </li>
</el-option> <li><input type="button" class="hollowFixedBtn" :value="$t('pub.searchBtn')" @click="resetPageIndex(),getList()" />
</el-select> <input type="button" class="normalBtn" :value="$t('pub.addBtn')" @click="outerVisible=true,dialogTitle='添加地接图片'" /></li>
</li> </ul>
<li><input type="button" class="hollowFixedBtn" :value="$t('pub.searchBtn')" @click="resetPageIndex(),getList()"/>
<input type="button" class="normalBtn" :value="$t('pub.addBtn')" @click="outerVisible=true,dialogTitle='添加地接图片'"/></li>
</ul>
</div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
<tr>
<th>{{$t('system.label_img')}}</th>
<th>{{$t('system.query_type')}}</th>
<th>{{$t('system.query_airName')}}</th>
<th width="300">{{$t('system.label_info')}}</th>
<th>{{$t('admin.admin_czPerson')}}</th>
<th>{{$t('hotel.table_operattime')}}</th>
<th>{{$t('hotel.table_operat')}}</th>
</tr>
<tr v-for="(item,index) in DataList">
<td class="picturMG">
<img v-if="!item.PicPath" src="../../assets/img/bg_c3@3x.png">
<img v-else :src="item.PicPath" :onerror='defaultImg'>
</td>
<td>{{item.TypeName}}</td>
<td>{{item.Name}}</td>
<td>{{item.DescriptionText}}</td>
<td>{{item.OperateName}}</td>
<td>{{item.UpdateDateStr}}</td>
<td>
<el-tooltip class="item" effect="dark" content="修改" placement="top">
<el-button type="primary" icon="el-icon-edit" circle @click="outerVisible=true,dialogTitle='修改',updateData(index)"></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" :content="$t('system.table_delete')" placement="top-start">
<el-button type="danger" icon="el-icon-delete" circle @click="deletelist(index)"></el-button>
</el-tooltip>
</td>
</tr>
</table>
<div class="noData" v-show="noData">
{{$t('system.content_noData')}}
</div>
<el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage" layout="total,prev, pager, next, jumper" :page-size=msg.pageSize :total=total>
</el-pagination>
<el-dialog custom-class='addCompany' :title="dialogTitle" :visible.sync="outerVisible" center :before-close="closeChangeMachie">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px" >
<el-form-item :label="$t('admin.mane')" prop="Name">
<el-input type="text" v-model="addMsg.Name" maxlength="20" class="w210"></el-input>
</el-form-item>
<el-form-item :label="$t('admin.admin_type')" prop="Type">
<el-select v-model="addMsg.Type" filterable :placeholder="$t('system.ph_choice')" class="w210">
<el-option v-for='item in PicTypeList'
:key="item.Id"
:label="item.Name"
:value="item.Id">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('system.label_img')">
<el-upload
class="avatar-uploader"
:action="importFileUrl"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item :label="$t('system.label_info')">
<el-input type="textarea" v-model="addMsg.DescriptionText" class="w210"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<button class="normalBtn" type="primary" @click="submitForm('addMsg'),resetPageIndex()">{{$t('pub.saveBtn')}}</button> &nbsp;
<button class="hollowFixedBtn" @click="outerVisible = false,resetForm('addMsg')">{{$t('pub.cancelBtn')}}</button>
</div>
</el-dialog>
</div> </div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
<tr>
<th>{{$t('system.label_img')}}</th>
<th>{{$t('system.query_type')}}</th>
<th>{{$t('system.query_airName')}}</th>
<th width="300">{{$t('system.label_info')}}</th>
<th>{{$t('admin.admin_czPerson')}}</th>
<th>{{$t('hotel.table_operattime')}}</th>
<th>{{$t('hotel.table_operat')}}</th>
</tr>
<tr v-for="(item,index) in DataList">
<td class="picturMG">
<img v-if="!item.PicPath" src="../../assets/img/bg_c3@3x.png">
<img v-else :src="item.PicPath" :onerror='defaultImg'>
</td>
<td>{{item.TypeName}}</td>
<td>{{item.Name}}</td>
<td>{{item.DescriptionText}}</td>
<td>{{item.OperateName}}</td>
<td>{{item.UpdateDateStr}}</td>
<td>
<el-tooltip class="item" effect="dark" content="修改" placement="top">
<el-button type="primary" icon="el-icon-edit" circle @click="outerVisible=true,dialogTitle='修改',updateData(index)"></el-button>
</el-tooltip>
<el-tooltip class="item" effect="dark" :content="$t('system.table_delete')" placement="top-start">
<el-button type="danger" icon="el-icon-delete" circle @click="deletelist(index)"></el-button>
</el-tooltip>
</td>
</tr>
</table>
<div class="noData" v-show="noData">
{{$t('system.content_noData')}}
</div>
<el-pagination background @current-change="handleCurrentChange" :current-page.sync="currentPage" layout="total,prev, pager, next, jumper"
:page-size="msg.pageSize" :total="total">
</el-pagination>
<el-dialog custom-class='addCompany' :title="dialogTitle" :visible.sync="outerVisible" center :before-close="closeChangeMachie">
<el-form :model="addMsg" :rules="rules" ref="addMsg" label-width="100px">
<el-form-item :label="$t('admin.mane')" prop="Name">
<el-input type="text" v-model="addMsg.Name" maxlength="20" class="w210"></el-input>
</el-form-item>
<el-form-item :label="$t('admin.admin_type')" prop="Type">
<el-select v-model="addMsg.Type" filterable :placeholder="$t('system.ph_choice')" class="w210">
<el-option v-for='item in PicTypeList' :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('system.label_img')">
<el-upload class="avatar-uploader" :action="importFileUrl" :show-file-list="false" :on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-form-item :label="$t('system.label_info')">
<el-input type="textarea" v-model="addMsg.DescriptionText" class="w210"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<button class="normalBtn" type="primary" @click="submitForm('addMsg'),resetPageIndex()">{{$t('pub.saveBtn')}}</button>
&nbsp;
<button class="hollowFixedBtn" @click="outerVisible = false,resetForm('addMsg')">{{$t('pub.cancelBtn')}}</button>
</div>
</el-dialog>
</div>
</template> </template>
<script> <script>
export default { export default {
data(){ data() {
return{ return {
msg:{ msg: {
pageIndex:1, pageIndex: 1,
pageSize:5, pageSize: 5,
Name:'', Name: '',
Type:'-1', Type: '-1',
},
addMsg:{
ID:0,
Name:'',
PicPath:'',
DescriptionText:'',
Type:''
},
PicTypeList:'',
DataList:'',
total:0,
currentPage:1,
loading:true,
outerVisible: false,
noData:false,
importFileUrl: this.domainManager().UploadFileUrl+'?cmd=User_post_FileUpload&fileType=1&fileLimit=10',
defaultImg: 'this.src="' + require('../../assets/img/bg_z1@2x.png') + '"',
dialogTitle:'',
insideDialogTxt: '保存成功!',
imageUrl: '',
rules: {//表单必填验证
Name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
Type: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
}
}
},methods:{
getList(){ //获取列表
this.loading = true;
this.apipost('Pictureresource_get_GetPageList',this.msg,res=>{
if(res.data.resultCode==1){
this.total = res.data.data.count;
if(res.data.data.pageData.length<1){
this.noData= true;
this.DataList=[];
this.loading = false;
}else{
this.noData= false;
res.data.data.pageData.forEach(x => {
if(x.PicPath){
x.PicPath = this.domainManager().ViittoFileUrl+x.PicPath
}
});
this.DataList = res.data.data.pageData
this.loading = false;
}
}else{
this.loading = false;
}
},err=>{})
}, },
addInstitutions(){ //添加图片资源 addMsg: {
this.apipost('Pictureresource_post_Set',this.addMsg,res=>{ ID: 0,
if(res.data.resultCode == 1) { Name: '',
this.tips("保存成功!",'success') PicPath: '',
this.getList(); DescriptionText: '',
this.outerVisible = false; Type: ''
this.initAddMsg();
} else {
this.tips(res.data.message,'warning')
}
},err=>{})
}, },
deletInstitutions(index){//删除 PicTypeList: '',
let msg = {ID:this.DataList[index].ID} DataList: '',
this.apipost('Pictureresource_post_Remove',msg,res=>{ total: 0,
if(res.data.resultCode == 1) { currentPage: 1,
this.tips("删除成功",'success') loading: true,
} outerVisible: false,
this.getList(); noData: false,
},err=>{}) importFileUrl: this.domainManager().UploadFileUrl + '?cmd=User_post_FileUpload&fileType=1&fileLimit=10',
}, defaultImg: 'this.src="' + require('../../assets/img/bg_z1@2x.png') + '"',
initAddMsg(){//初始化添加、修改数据 dialogTitle: '',
let newMsg = { insideDialogTxt: '保存成功!',
ID:0, imageUrl: '',
Name:'', rules: { //表单必填验证
PicPath:'', Name: [{
DescriptionText:'', required: true,
Type:'' message: '请输入名称',
} trigger: 'blur'
this.addMsg = newMsg; }],
}, Type: [{
updateData(index){//修改获取 required: true,
let msg = {ID:this.DataList[index].ID} message: '请选择类型',
this.apipost('Pictureresource_get_Get',msg,res=>{ trigger: 'change'
this.addMsg = res.data.data }],
this.imageUrl = this.addMsg.PicPath }
},err=>{}) }
}, },
submitForm(addMsg) {//提交创建、修改表单 methods: {
this.$refs[addMsg].validate((valid) => { getList() { //获取列表
if (valid) { this.loading = true;
this.addInstitutions() this.apipost('Pictureresource_get_GetPageList', this.msg, res => {
} else { if (res.data.resultCode == 1) {
console.log('error submit!!'); this.total = res.data.data.count;
return false; if (res.data.data.pageData.length < 1) {
this.noData = true;
this.DataList = [];
this.loading = false;
} else {
this.noData = false;
res.data.data.pageData.forEach(x => {
if (x.PicPath) {
x.PicPath = this.domainManager().ViittoFileUrl + x.PicPath
} }
}); });
}, this.DataList = res.data.data.pageData
handleAvatarSuccess(res, file) { //上传 this.loading = false;
if(res.resultCode==1){
var img_path = res.data.FullFilePath
this.addMsg.PicPath=res.data.FilePath
this.imageUrl = img_path
}
},
beforeAvatarUpload(file) { //上传-
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 格式!');
} }
if (!isLt2M) { } else {
this.$message.error('上传头像图片大小不能超过 2MB!'); this.loading = false;
} }
return isJPG && isLt2M; }, err => {})
}, },
resetPageIndex() {//查询初始化页码 addInstitutions() { //添加图片资源
this.msg.pageIndex = 1; this.apipost('Pictureresource_post_Set', this.addMsg, res => {
this.currentPage = 1 if (res.data.resultCode == 1) {
}, this.tips("保存成功!", 'success')
handleCurrentChange(val) {//翻页功能按钮
this.msg.pageIndex = val;
this.getList(); this.getList();
}, this.outerVisible = false;
closeChangeMachie(done){ this.initAddMsg();
done(); } else {
this.resetForm('addMsg'); this.tips(res.data.message, 'warning')
}, }
resetForm(formName) { }, err => {})
this.initAddMsg(); },
this.$refs[formName].resetFields(); deletInstitutions(index) { //删除
}, let msg = {
getPicTypeList(){ ID: this.DataList[index].ID
this.apipost('Pictureresource_get_GetPicTypeList',{},res=>{ }
this.PicTypeList = res.data.data this.apipost('Pictureresource_post_Remove', msg, res => {
},err=>{}) if (res.data.resultCode == 1) {
}, this.tips("删除成功", 'success')
tips(msg,type) { }
this.$message({ this.getList();
message: msg, }, err => {})
duration:2000, },
type: type initAddMsg() { //初始化添加、修改数据
}); let newMsg = {
}, ID: 0,
deletelist(index){ Name: '',
this.$confirm('是否删除?', '提示', { PicPath: '',
confirmButtonText: '确定', DescriptionText: '',
cancelButtonText: '取消', Type: ''
type: 'warning' }
}).then(() => { this.addMsg = newMsg;
this.$message({ },
type: 'success', updateData(index) { //修改获取
message: '删除成功!' let msg = {
}); ID: this.DataList[index].ID
this.deletInstitutions(index) }
}).catch(() => { this.apipost('Pictureresource_get_Get', msg, res => {
this.$message({ this.addMsg = res.data.data
type: 'info', this.imageUrl = this.addMsg.PicPath
message: '已取消删除' }, err => {})
}); },
}); submitForm(addMsg) { //提交创建、修改表单
this.$refs[addMsg].validate((valid) => {
if (valid) {
this.addInstitutions()
} else {
return false;
}
});
},
handleAvatarSuccess(res, file) { //上传
if (res.resultCode == 1) {
var img_path = res.data.FullFilePath
this.addMsg.PicPath = res.data.FilePath
this.imageUrl = img_path
}
},
beforeAvatarUpload(file) { //上传-
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
} }
},mounted(){ return isJPG && isLt2M;
},
resetPageIndex() { //查询初始化页码
this.msg.pageIndex = 1;
this.currentPage = 1
},
handleCurrentChange(val) { //翻页功能按钮
this.msg.pageIndex = val;
this.getList(); this.getList();
this.getPicTypeList(); },
closeChangeMachie(done) {
done();
this.resetForm('addMsg');
},
resetForm(formName) {
this.initAddMsg();
this.$refs[formName].resetFields();
},
getPicTypeList() {
this.apipost('Pictureresource_get_GetPicTypeList', {}, res => {
this.PicTypeList = res.data.data
}, err => {})
},
tips(msg, type) {
this.$message({
message: msg,
duration: 2000,
type: type
});
},
deletelist(index) {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
this.deletInstitutions(index)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
}
},
mounted() {
this.getList();
this.getPicTypeList();
} }
} }
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment