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)
}) })
......
...@@ -29,15 +29,12 @@ ...@@ -29,15 +29,12 @@
<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"
:label="item.Name"
:value="item.Id">
</el-option> </el-option>
</el-select> </el-select>
</li> </li>
<li><input type="button" class="hollowFixedBtn" :value="$t('pub.searchBtn')" @click="resetPageIndex(),getList()"/> <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> <input type="button" class="normalBtn" :value="$t('pub.addBtn')" @click="outerVisible=true,dialogTitle='添加地接图片'" /></li>
</ul> </ul>
</div> </div>
<table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading"> <table class="singeRowTable" border="0" cellspacing="0" cellpadding="0" v-loading="loading">
...@@ -73,28 +70,22 @@ ...@@ -73,28 +70,22 @@
<div class="noData" v-show="noData"> <div class="noData" v-show="noData">
{{$t('system.content_noData')}} {{$t('system.content_noData')}}
</div> </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 background @current-change="handleCurrentChange" :current-page.sync="currentPage" layout="total,prev, pager, next, jumper"
:page-size="msg.pageSize" :total="total">
</el-pagination> </el-pagination>
<el-dialog custom-class='addCompany' :title="dialogTitle" :visible.sync="outerVisible" center :before-close="closeChangeMachie"> <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 :model="addMsg" :rules="rules" ref="addMsg" label-width="100px">
<el-form-item :label="$t('admin.mane')" prop="Name"> <el-form-item :label="$t('admin.mane')" prop="Name">
<el-input type="text" v-model="addMsg.Name" maxlength="20" class="w210"></el-input> <el-input type="text" v-model="addMsg.Name" maxlength="20" class="w210"></el-input>
</el-form-item> </el-form-item>
<el-form-item :label="$t('admin.admin_type')" prop="Type"> <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-select v-model="addMsg.Type" filterable :placeholder="$t('system.ph_choice')" class="w210">
<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"
:label="item.Name"
:value="item.Id">
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('system.label_img')"> <el-form-item :label="$t('system.label_img')">
<el-upload <el-upload class="avatar-uploader" :action="importFileUrl" :show-file-list="false" :on-success="handleAvatarSuccess"
class="avatar-uploader"
:action="importFileUrl"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"> :before-upload="beforeAvatarUpload">
<img v-if="imageUrl" :src="imageUrl" class="avatar"> <img v-if="imageUrl" :src="imageUrl" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i> <i v-else class="el-icon-plus avatar-uploader-icon"></i>
...@@ -105,127 +96,136 @@ ...@@ -105,127 +96,136 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<button class="normalBtn" type="primary" @click="submitForm('addMsg'),resetPageIndex()">{{$t('pub.saveBtn')}}</button> &nbsp; <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> <button class="hollowFixedBtn" @click="outerVisible = false,resetForm('addMsg')">{{$t('pub.cancelBtn')}}</button>
</div> </div>
</el-dialog> </el-dialog>
</div> </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:{ addMsg: {
ID:0, ID: 0,
Name:'', Name: '',
PicPath:'', PicPath: '',
DescriptionText:'', DescriptionText: '',
Type:'' Type: ''
}, },
PicTypeList:'', PicTypeList: '',
DataList:'', DataList: '',
total:0, total: 0,
currentPage:1, currentPage: 1,
loading:true, loading: true,
outerVisible: false, outerVisible: false,
noData:false, noData: false,
importFileUrl: this.domainManager().UploadFileUrl+'?cmd=User_post_FileUpload&fileType=1&fileLimit=10', importFileUrl: this.domainManager().UploadFileUrl + '?cmd=User_post_FileUpload&fileType=1&fileLimit=10',
defaultImg: 'this.src="' + require('../../assets/img/bg_z1@2x.png') + '"', defaultImg: 'this.src="' + require('../../assets/img/bg_z1@2x.png') + '"',
dialogTitle:'', dialogTitle: '',
insideDialogTxt: '保存成功!', insideDialogTxt: '保存成功!',
imageUrl: '', imageUrl: '',
rules: {//表单必填验证 rules: { //表单必填验证
Name: [ Name: [{
{ required: true, message: '请输入名称', trigger: 'blur' } required: true,
], message: '请输入名称',
Type: [ trigger: 'blur'
{ required: true, message: '请选择类型', trigger: 'change' } }],
], Type: [{
required: true,
message: '请选择类型',
trigger: 'change'
}],
} }
} }
},methods:{ },
getList(){ //获取列表 methods: {
getList() { //获取列表
this.loading = true; this.loading = true;
this.apipost('Pictureresource_get_GetPageList',this.msg,res=>{ this.apipost('Pictureresource_get_GetPageList', this.msg, res => {
if(res.data.resultCode==1){ if (res.data.resultCode == 1) {
this.total = res.data.data.count; this.total = res.data.data.count;
if(res.data.data.pageData.length<1){ if (res.data.data.pageData.length < 1) {
this.noData= true; this.noData = true;
this.DataList=[]; this.DataList = [];
this.loading = false; this.loading = false;
}else{ } else {
this.noData= false; this.noData = false;
res.data.data.pageData.forEach(x => { res.data.data.pageData.forEach(x => {
if(x.PicPath){ if (x.PicPath) {
x.PicPath = this.domainManager().ViittoFileUrl+x.PicPath x.PicPath = this.domainManager().ViittoFileUrl + x.PicPath
} }
}); });
this.DataList = res.data.data.pageData this.DataList = res.data.data.pageData
this.loading = false; this.loading = false;
} }
}else{ } else {
this.loading = false; this.loading = false;
} }
},err=>{}) }, err => {})
}, },
addInstitutions(){ //添加图片资源 addInstitutions() { //添加图片资源
this.apipost('Pictureresource_post_Set',this.addMsg,res=>{ this.apipost('Pictureresource_post_Set', this.addMsg, res => {
if(res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.tips("保存成功!",'success') this.tips("保存成功!", 'success')
this.getList(); this.getList();
this.outerVisible = false; this.outerVisible = false;
this.initAddMsg(); this.initAddMsg();
} else { } else {
this.tips(res.data.message,'warning') this.tips(res.data.message, 'warning')
} }
},err=>{}) }, err => {})
}, },
deletInstitutions(index){//删除 deletInstitutions(index) { //删除
let msg = {ID:this.DataList[index].ID} let msg = {
this.apipost('Pictureresource_post_Remove',msg,res=>{ ID: this.DataList[index].ID
if(res.data.resultCode == 1) { }
this.tips("删除成功",'success') this.apipost('Pictureresource_post_Remove', msg, res => {
if (res.data.resultCode == 1) {
this.tips("删除成功", 'success')
} }
this.getList(); this.getList();
},err=>{}) }, err => {})
}, },
initAddMsg(){//初始化添加、修改数据 initAddMsg() { //初始化添加、修改数据
let newMsg = { let newMsg = {
ID:0, ID: 0,
Name:'', Name: '',
PicPath:'', PicPath: '',
DescriptionText:'', DescriptionText: '',
Type:'' Type: ''
} }
this.addMsg = newMsg; this.addMsg = newMsg;
}, },
updateData(index){//修改获取 updateData(index) { //修改获取
let msg = {ID:this.DataList[index].ID} let msg = {
this.apipost('Pictureresource_get_Get',msg,res=>{ ID: this.DataList[index].ID
}
this.apipost('Pictureresource_get_Get', msg, res => {
this.addMsg = res.data.data this.addMsg = res.data.data
this.imageUrl = this.addMsg.PicPath this.imageUrl = this.addMsg.PicPath
},err=>{}) }, err => {})
}, },
submitForm(addMsg) {//提交创建、修改表单 submitForm(addMsg) { //提交创建、修改表单
this.$refs[addMsg].validate((valid) => { this.$refs[addMsg].validate((valid) => {
if (valid) { if (valid) {
this.addInstitutions() this.addInstitutions()
} else { } else {
console.log('error submit!!');
return false; return false;
} }
}); });
}, },
handleAvatarSuccess(res, file) { //上传 handleAvatarSuccess(res, file) { //上传
if(res.resultCode==1){ if (res.resultCode == 1) {
var img_path = res.data.FullFilePath var img_path = res.data.FullFilePath
this.addMsg.PicPath=res.data.FilePath this.addMsg.PicPath = res.data.FilePath
this.imageUrl = img_path this.imageUrl = img_path
} }
}, },
...@@ -240,15 +240,15 @@ export default { ...@@ -240,15 +240,15 @@ export default {
} }
return isJPG && isLt2M; return isJPG && isLt2M;
}, },
resetPageIndex() {//查询初始化页码 resetPageIndex() { //查询初始化页码
this.msg.pageIndex = 1; this.msg.pageIndex = 1;
this.currentPage = 1 this.currentPage = 1
}, },
handleCurrentChange(val) {//翻页功能按钮 handleCurrentChange(val) { //翻页功能按钮
this.msg.pageIndex = val; this.msg.pageIndex = val;
this.getList(); this.getList();
}, },
closeChangeMachie(done){ closeChangeMachie(done) {
done(); done();
this.resetForm('addMsg'); this.resetForm('addMsg');
}, },
...@@ -256,19 +256,19 @@ export default { ...@@ -256,19 +256,19 @@ export default {
this.initAddMsg(); this.initAddMsg();
this.$refs[formName].resetFields(); this.$refs[formName].resetFields();
}, },
getPicTypeList(){ getPicTypeList() {
this.apipost('Pictureresource_get_GetPicTypeList',{},res=>{ this.apipost('Pictureresource_get_GetPicTypeList', {}, res => {
this.PicTypeList = res.data.data this.PicTypeList = res.data.data
},err=>{}) }, err => {})
}, },
tips(msg,type) { tips(msg, type) {
this.$message({ this.$message({
message: msg, message: msg,
duration:2000, duration: 2000,
type: type type: type
}); });
}, },
deletelist(index){ deletelist(index) {
this.$confirm('是否删除?', '提示', { this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -286,11 +286,10 @@ export default { ...@@ -286,11 +286,10 @@ export default {
}); });
}); });
} }
},mounted(){ },
mounted() {
this.getList(); this.getList();
this.getPicTypeList(); 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