|
@@ -29,7 +29,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog title="图例图标 开发中,尚未完成..." :visible.sync="dlgIconVisible">
|
|
|
+ <el-dialog title="图例图标" :visible.sync="dlgIconVisible">
|
|
|
<div>
|
|
|
<el-form>
|
|
|
<el-upload
|
|
@@ -83,17 +83,34 @@
|
|
|
|
|
|
currentAnchor: any;
|
|
|
|
|
|
+ icons:any = {};
|
|
|
iconAction = '';
|
|
|
imageUrl = '';
|
|
|
|
|
|
sysChange(){
|
|
|
this.currentSys = this.sysVal[this.sysVal.length - 1];
|
|
|
|
|
|
- const params:any = {sys: this.currentSys};
|
|
|
- this['$axios'].get(this['$common'].url + "legend/getLegends?sys=" + this.currentSys)
|
|
|
+ this['$axios'].get(this['$common'].url + "icon/icons/type?system=" + this.currentSys)
|
|
|
.then(res => {
|
|
|
- this.currentData = res.data.data;
|
|
|
- this.openEditor(this.currentData);
|
|
|
+ const items = res.data.data;
|
|
|
+ this.icons = {};
|
|
|
+ for(const item of items) {
|
|
|
+ this.icons[item.legendId] = item;
|
|
|
+ }
|
|
|
+
|
|
|
+ this['$axios'].get(this['$common'].url + "legend/getLegends?sys=" + this.currentSys)
|
|
|
+ .then(res => {
|
|
|
+ this.currentData = res.data.data;
|
|
|
+ for(const legend of this.currentData) {
|
|
|
+ const icon = this.icons[legend.id];
|
|
|
+ if(icon != null)
|
|
|
+ legend.iconId = icon.id;
|
|
|
+ }
|
|
|
+ this.openEditor(this.currentData);
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ //console.log(err);
|
|
|
+ });
|
|
|
})
|
|
|
.catch(err => {
|
|
|
//console.log(err);
|
|
@@ -151,13 +168,25 @@
|
|
|
|
|
|
manageIcon(){
|
|
|
const legend: any = this.editor.getSelComp();
|
|
|
- this.iconAction = this['$common'].url + "legend/uploadIcon?legendId=" + legend.id; //TODO上传action路径
|
|
|
- this.imageUrl = ''; //TODO 获取已有的图标链接
|
|
|
+ this.iconAction = this['$common'].url + "icon/uploadIcon?legendId=" + legend.id + '&system=' + this.currentSys;
|
|
|
+ if(legend.iconId)
|
|
|
+ this.imageUrl = this['$common'].url + "icon/showImage?id=" + legend.iconId;
|
|
|
+ else
|
|
|
+ this.imageUrl = '';
|
|
|
+
|
|
|
this.dlgIconVisible = true;
|
|
|
}
|
|
|
|
|
|
handleAvatarSuccess(res, file) {
|
|
|
this.imageUrl = URL.createObjectURL(file.raw);
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '上传成功!'
|
|
|
+ });
|
|
|
+ const newIcon = res.data;
|
|
|
+ const legend: any = this.editor.getSelComp();
|
|
|
+ legend.iconId = newIcon.id;
|
|
|
+ this.editor.redraw();
|
|
|
}
|
|
|
|
|
|
beforeAvatarUpload(file) {
|