|
@@ -391,38 +391,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)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 铺位可视化
|