|
@@ -41,7 +41,7 @@
|
|
|
</div>
|
|
|
<div v-show='ruleForm.Type=="Zone" || ruleForm.Type=="Image" || ruleForm.Type =="Line"'>
|
|
|
<div style='color:#646C73'>展示预览</div>
|
|
|
- <div class='input-right' ref='graph' style="width:200px;height:114px;">
|
|
|
+ <div class='input-right' ref='graph' style='width:200px;height:114px;'>
|
|
|
<canvas id='canvas' :width='canvasWidth' :height='canvasHeight'></canvas>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -390,38 +390,44 @@ export default {
|
|
|
},
|
|
|
// 把canvas图保存到图片服务器
|
|
|
saveImg() {
|
|
|
- let vm = this
|
|
|
- if(!this.file){
|
|
|
- //修改图片的时候没有重新上传图片
|
|
|
- this.update()
|
|
|
- this.$emit('updateSuccess')
|
|
|
- this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
- }else{
|
|
|
- if (this.view) {
|
|
|
- let data = this.view.canvasView.toDataURL('image/png')
|
|
|
- var formData = new FormData()
|
|
|
- if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
|
|
|
- formData.append('file', this.base64ToFile(data))
|
|
|
- } else {
|
|
|
- formData.append('file', this.file)
|
|
|
+ let vm = this
|
|
|
+ if (!this.file) {
|
|
|
+ //修改图片的时候没有重新上传图片
|
|
|
+ if (this.title == '添加图例库') {
|
|
|
+ this.create()
|
|
|
+ this.$emit('addSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
+ } else if (this.title == '修改图例库') {
|
|
|
+ this.update()
|
|
|
+ this.$emit('updateSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
}
|
|
|
- let postParams = formData
|
|
|
- uploadImg({ postParams }).then(res => {
|
|
|
- if (res.Result == 'success') {
|
|
|
- this.$set(vm.ruleForm, 'Url', res.EntityList[0])
|
|
|
- this.$message.success('图标上传成功!')
|
|
|
- if (this.title == '添加图例库') {
|
|
|
- this.create()
|
|
|
- this.$emit('addSuccess')
|
|
|
- this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
- } else if (this.title == '修改图例库') {
|
|
|
- this.update()
|
|
|
- this.$emit('updateSuccess')
|
|
|
- this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ if (this.view) {
|
|
|
+ let data = this.view.canvasView.toDataURL('image/png')
|
|
|
+ var formData = new FormData()
|
|
|
+ if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
|
|
|
+ formData.append('file', this.base64ToFile(data))
|
|
|
+ } else {
|
|
|
+ formData.append('file', this.file)
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
+ let postParams = formData
|
|
|
+ uploadImg({ postParams }).then(res => {
|
|
|
+ if (res.Result == 'success') {
|
|
|
+ this.$set(vm.ruleForm, 'Url', res.EntityList[0])
|
|
|
+ this.$message.success('图标上传成功!')
|
|
|
+ if (this.title == '添加图例库') {
|
|
|
+ this.create()
|
|
|
+ this.$emit('addSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
+ } else if (this.title == '修改图例库') {
|
|
|
+ this.update()
|
|
|
+ this.$emit('updateSuccess')
|
|
|
+ this.view.canvas.clearRect(0, 0, this.width, this.height)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 铺位可视化
|