|
@@ -141,15 +141,15 @@ export default {
|
|
|
],
|
|
|
linepxOption: [
|
|
|
{
|
|
|
- id: '1',
|
|
|
+ id: 1,
|
|
|
src: require('@/assets/imgs/1pxline.jpg')
|
|
|
},
|
|
|
{
|
|
|
- id: '2',
|
|
|
+ id: 2,
|
|
|
src: require('@/assets/imgs/2pxline.jpg')
|
|
|
},
|
|
|
{
|
|
|
- id: '3',
|
|
|
+ id: 3,
|
|
|
src: require('@/assets/imgs/3pxline.jpg')
|
|
|
}
|
|
|
],
|
|
@@ -165,10 +165,13 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
props: ['ruleForm', 'title'],
|
|
|
- computed: {},
|
|
|
+ updated() {
|
|
|
+ this.changeLineWidth(this.ruleForm.LineWidth)
|
|
|
+ this.changeLineType(this.ruleForm.LineDash)
|
|
|
+ this.initGraph()
|
|
|
+ },
|
|
|
methods: {
|
|
|
getFile(file) {
|
|
|
- console.log(file)
|
|
|
var formData = new FormData()
|
|
|
formData.append('file', file.file)
|
|
|
let postParams = formData
|
|
@@ -213,12 +216,18 @@ export default {
|
|
|
this.fileList = fileList.slice(-1)
|
|
|
},
|
|
|
clearGraphy(type) {
|
|
|
- if (this.view) {
|
|
|
- this.view.type = type
|
|
|
- return
|
|
|
+ if (!(this.view instanceof GraphView)) {
|
|
|
+ this.view = new GraphView('canvas')
|
|
|
}
|
|
|
- this.view = new GraphView('canvas')
|
|
|
this.view.type = type
|
|
|
+ if (this.ruleForm.FillColor.indexOf('#') > -1) {
|
|
|
+ this.view.bgcolor = this.ruleForm.FillColor
|
|
|
+ } else {
|
|
|
+ this.view.bgcolor = this.hexify(this.ruleForm.FillColor)
|
|
|
+ }
|
|
|
+ this.view.strokecolor = this.ruleForm.Color
|
|
|
+ this.view.lineType = this.ruleForm.LineDash
|
|
|
+ this.view.lineWidth = this.ruleForm.LineWidth
|
|
|
},
|
|
|
initGraph() {
|
|
|
if (this.ruleForm.Type == 'Zone' || this.ruleForm.Type == 'Line') {
|
|
@@ -252,8 +261,7 @@ export default {
|
|
|
},
|
|
|
//线条类型改变
|
|
|
changeLineType(val) {
|
|
|
- console.log(val)
|
|
|
- this.ruleForm.LineDash = val
|
|
|
+ this.$set(this.ruleForm, 'LineDash', val)
|
|
|
this.borderLineOptionObject = val && this.borderLineOption.find(item => item.id == val)
|
|
|
this.$refs.select1.$el.children[0].children[0].setAttribute(
|
|
|
'style',
|
|
@@ -265,7 +273,7 @@ export default {
|
|
|
},
|
|
|
//线条宽度
|
|
|
changeLineWidth(val) {
|
|
|
- this.ruleForm.LineWidth = val
|
|
|
+ this.$set(this.ruleForm, 'LineWidth', val)
|
|
|
this.linepxObject = val && this.linepxOption.find(item => item.id == val)
|
|
|
this.$refs.select.$el.children[0].children[0].setAttribute(
|
|
|
'style',
|
|
@@ -292,11 +300,9 @@ export default {
|
|
|
saveImg() {
|
|
|
if (this.view) {
|
|
|
let data = this.view.canvasView.toDataURL('image/png')
|
|
|
- console.log(data)
|
|
|
var formData = new FormData()
|
|
|
formData.append('file', this.base64ToFile(data))
|
|
|
let postParams = formData
|
|
|
- console.log(postParams, 'posssss')
|
|
|
uploadImg({ postParams }).then(res => {
|
|
|
if (res.Result == 'success') {
|
|
|
this.$set(this.ruleForm, 'Url', res.EntityList[0])
|
|
@@ -316,7 +322,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- mounted() {}
|
|
|
+ mounted() {
|
|
|
+ this.changeLineWidth(this.ruleForm.LineWidth)
|
|
|
+ this.changeLineType(this.ruleForm.LineDash)
|
|
|
+ this.initGraph()
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|