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

上传修改

parent 02011c31
......@@ -210,10 +210,11 @@
methods: {
downLoadPZ: function (src) {
const link = document.createElement('a');
link.href = src;
document.body.appendChild(link);
link.click();
var a = document.createElement('a')
var event = new MouseEvent('click')
a.download = '下载图片名称'
a.href = src;
a.dispatchEvent(event)
},
stringToArr(str) {
return str.split(',')
......
......@@ -579,6 +579,7 @@
res => {
if (res.data.resultCode == 1) {
var tempData = res.data.data;
console.log("tempData",tempData);
if (tempData.Feature != null) {
this.FeatureData.ID = tempData.Feature.ID;
this.FeatureData.ConfigId = tempData.Feature.ConfigId;
......
......@@ -1550,7 +1550,7 @@
var fileName = `${that.uuid(10,10)}.png`;
var path = `/feature/${that.cid}/${fileName}`;
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];
that.imgUrlChange(allPath)
})
......
......@@ -29,15 +29,12 @@
<label class="">{{$t('admin.admin_type')}}</label>
<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 v-for='item in PicTypeList'
:key="item.Id"
:label="item.Name"
:value="item.Id">
<el-option v-for='item in PicTypeList' :key="item.Id" :label="item.Name" :value="item.Id">
</el-option>
</el-select>
</li>
<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>
<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">
......@@ -73,28 +70,22 @@
<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 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 :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 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"
<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>
......@@ -105,127 +96,136 @@
</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="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>
<script>
export default {
data(){
return{
msg:{
pageIndex:1,
pageSize:5,
Name:'',
Type:'-1',
export default {
data() {
return {
msg: {
pageIndex: 1,
pageSize: 5,
Name: '',
Type: '-1',
},
addMsg:{
ID:0,
Name:'',
PicPath:'',
DescriptionText:'',
Type:''
addMsg: {
ID: 0,
Name: '',
PicPath: '',
DescriptionText: '',
Type: ''
},
PicTypeList:'',
DataList:'',
total:0,
currentPage:1,
loading:true,
PicTypeList: '',
DataList: '',
total: 0,
currentPage: 1,
loading: true,
outerVisible: false,
noData:false,
importFileUrl: this.domainManager().UploadFileUrl+'?cmd=User_post_FileUpload&fileType=1&fileLimit=10',
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:'',
dialogTitle: '',
insideDialogTxt: '保存成功!',
imageUrl: '',
rules: {//表单必填验证
Name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
],
Type: [
{ required: true, message: '请选择类型', trigger: 'change' }
],
rules: { //表单必填验证
Name: [{
required: true,
message: '请输入名称',
trigger: 'blur'
}],
Type: [{
required: true,
message: '请选择类型',
trigger: 'change'
}],
}
}
},methods:{
getList(){ //获取列表
},
methods: {
getList() { //获取列表
this.loading = true;
this.apipost('Pictureresource_get_GetPageList',this.msg,res=>{
if(res.data.resultCode==1){
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=[];
if (res.data.data.pageData.length < 1) {
this.noData = true;
this.DataList = [];
this.loading = false;
}else{
this.noData= false;
} else {
this.noData = false;
res.data.data.pageData.forEach(x => {
if(x.PicPath){
x.PicPath = this.domainManager().ViittoFileUrl+x.PicPath
if (x.PicPath) {
x.PicPath = this.domainManager().ViittoFileUrl + x.PicPath
}
});
this.DataList = res.data.data.pageData
this.loading = false;
}
}else{
} else {
this.loading = false;
}
},err=>{})
}, err => {})
},
addInstitutions(){ //添加图片资源
this.apipost('Pictureresource_post_Set',this.addMsg,res=>{
if(res.data.resultCode == 1) {
this.tips("保存成功!",'success')
addInstitutions() { //添加图片资源
this.apipost('Pictureresource_post_Set', this.addMsg, res => {
if (res.data.resultCode == 1) {
this.tips("保存成功!", 'success')
this.getList();
this.outerVisible = false;
this.initAddMsg();
} else {
this.tips(res.data.message,'warning')
this.tips(res.data.message, 'warning')
}
},err=>{})
}, err => {})
},
deletInstitutions(index){//删除
let msg = {ID:this.DataList[index].ID}
this.apipost('Pictureresource_post_Remove',msg,res=>{
if(res.data.resultCode == 1) {
this.tips("删除成功",'success')
deletInstitutions(index) { //删除
let msg = {
ID: this.DataList[index].ID
}
this.apipost('Pictureresource_post_Remove', msg, res => {
if (res.data.resultCode == 1) {
this.tips("删除成功", 'success')
}
this.getList();
},err=>{})
}, err => {})
},
initAddMsg(){//初始化添加、修改数据
initAddMsg() { //初始化添加、修改数据
let newMsg = {
ID:0,
Name:'',
PicPath:'',
DescriptionText:'',
Type:''
ID: 0,
Name: '',
PicPath: '',
DescriptionText: '',
Type: ''
}
this.addMsg = newMsg;
},
updateData(index){//修改获取
let msg = {ID:this.DataList[index].ID}
this.apipost('Pictureresource_get_Get',msg,res=>{
updateData(index) { //修改获取
let msg = {
ID: this.DataList[index].ID
}
this.apipost('Pictureresource_get_Get', msg, res => {
this.addMsg = res.data.data
this.imageUrl = this.addMsg.PicPath
},err=>{})
}, err => {})
},
submitForm(addMsg) {//提交创建、修改表单
submitForm(addMsg) { //提交创建、修改表单
this.$refs[addMsg].validate((valid) => {
if (valid) {
this.addInstitutions()
} else {
console.log('error submit!!');
return false;
}
});
},
handleAvatarSuccess(res, file) { //上传
if(res.resultCode==1){
if (res.resultCode == 1) {
var img_path = res.data.FullFilePath
this.addMsg.PicPath=res.data.FilePath
this.addMsg.PicPath = res.data.FilePath
this.imageUrl = img_path
}
},
......@@ -240,15 +240,15 @@ export default {
}
return isJPG && isLt2M;
},
resetPageIndex() {//查询初始化页码
resetPageIndex() { //查询初始化页码
this.msg.pageIndex = 1;
this.currentPage = 1
},
handleCurrentChange(val) {//翻页功能按钮
handleCurrentChange(val) { //翻页功能按钮
this.msg.pageIndex = val;
this.getList();
},
closeChangeMachie(done){
closeChangeMachie(done) {
done();
this.resetForm('addMsg');
},
......@@ -256,19 +256,19 @@ export default {
this.initAddMsg();
this.$refs[formName].resetFields();
},
getPicTypeList(){
this.apipost('Pictureresource_get_GetPicTypeList',{},res=>{
getPicTypeList() {
this.apipost('Pictureresource_get_GetPicTypeList', {}, res => {
this.PicTypeList = res.data.data
},err=>{})
}, err => {})
},
tips(msg,type) {
tips(msg, type) {
this.$message({
message: msg,
duration:2000,
duration: 2000,
type: type
});
},
deletelist(index){
deletelist(index) {
this.$confirm('是否删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
......@@ -286,11 +286,10 @@ export default {
});
});
}
},mounted(){
},
mounted() {
this.getList();
this.getPicTypeList();
}
}
}
</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