|
@@ -111,7 +111,7 @@ import splitHandle from './split_handle'
|
|
|
import { mapGetters, mapActions } from 'vuex'
|
|
|
//api
|
|
|
import { getEquipmentAll, getQueryProperty } from '@/fetch/data_plat'
|
|
|
-import { batchCreate } from '@/fetch/point_http'
|
|
|
+import { updatePoint, batchCreate } from '@/fetch/point_http'
|
|
|
export default {
|
|
|
name: 'point_config_step3_edit',
|
|
|
computed: {
|
|
@@ -161,11 +161,11 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
/**值回显******* */
|
|
|
- noHandleShow: null,
|
|
|
- autoHandleShow: null,
|
|
|
- enumHandleShow: null,
|
|
|
- formulaHandleShow: null,
|
|
|
- splitHandleShow: null
|
|
|
+ noHandleShow: {},
|
|
|
+ autoHandleShow: {},
|
|
|
+ enumHandleShow: {},
|
|
|
+ formulaHandleShow: {},
|
|
|
+ splitHandleShow: {}
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -262,12 +262,19 @@ export default {
|
|
|
DataSourceId: this.datasourceId,
|
|
|
PointId: this.editData.Point.Id //点位ID
|
|
|
}
|
|
|
+ let updateParams = {
|
|
|
+ data: {
|
|
|
+ Content:[{ Id: this.editData.Point.Id }]
|
|
|
+ },
|
|
|
+ type: this.protocolType
|
|
|
+ }
|
|
|
let otherParams = {}
|
|
|
switch (type) {
|
|
|
case '无需处理,直接使用':
|
|
|
otherParams = {
|
|
|
EquipmentMark: other.EquipmentMark
|
|
|
}
|
|
|
+ updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
|
|
|
break
|
|
|
case '需自动单位转换':
|
|
|
let DataRuleContent1 = JSON.stringify([
|
|
@@ -286,6 +293,7 @@ export default {
|
|
|
DataRuleContent: DataRuleContent1,
|
|
|
EquipmentMark: other.EquipmentMark
|
|
|
}
|
|
|
+ updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
|
|
|
break
|
|
|
case '需按设置枚举转换':
|
|
|
let DataRuleContent2 = other.pointArr.length
|
|
@@ -295,6 +303,7 @@ export default {
|
|
|
EquipmentMark: other.EquipmentMark,
|
|
|
DataRuleContent: DataRuleContent2
|
|
|
}
|
|
|
+ updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
|
|
|
break
|
|
|
case '需按公式转换':
|
|
|
let subRule = other.from
|
|
@@ -346,6 +355,7 @@ export default {
|
|
|
EquipmentMark: other.EquipmentMark,
|
|
|
DataRuleContent: DataRuleContent3
|
|
|
}
|
|
|
+ updateParams.data.Content[0].EquipmentMark = other.EquipmentMark
|
|
|
break
|
|
|
case '需拆分处理':
|
|
|
let SplitPoints = other.devArr.length ? other.devArr : undefined
|
|
@@ -372,10 +382,11 @@ export default {
|
|
|
otherParams = {
|
|
|
SplitPoints: SplitPoints
|
|
|
}
|
|
|
+ updateParams.data.Content[0].EquipmentMark = other.eqMark
|
|
|
break
|
|
|
}
|
|
|
let params = [Object.assign(basicParams, otherParams)]
|
|
|
- this.create(params)
|
|
|
+ updatePoint(updateParams, res => { this.create(params) })
|
|
|
},
|
|
|
create(params) {
|
|
|
batchCreate(params, res => {
|
|
@@ -503,14 +514,14 @@ export default {
|
|
|
switch (flag) {
|
|
|
case '无需处理,直接使用':
|
|
|
this.noHandleShow = {
|
|
|
- EquipmentMark: data.EquipmentMark
|
|
|
+ EquipmentMark: eqMark
|
|
|
}
|
|
|
break
|
|
|
case '需自动单位转换':
|
|
|
dataRules = JSON.parse(data.DataRuleContent)
|
|
|
let auto = dataRules[0].content[0].from.split('-')
|
|
|
this.autoHandleShow = {
|
|
|
- EquipmentMark: data.EquipmentMark,
|
|
|
+ EquipmentMark: eqMark,
|
|
|
unit: auto
|
|
|
}
|
|
|
break
|
|
@@ -518,7 +529,7 @@ export default {
|
|
|
dataRules = JSON.parse(data.DataRuleContent)
|
|
|
let pointArr = dataRules[0].content
|
|
|
this.enumHandleShow = {
|
|
|
- EquipmentMark: data.EquipmentMark,
|
|
|
+ EquipmentMark: eqMark,
|
|
|
pointArr: pointArr
|
|
|
}
|
|
|
break
|
|
@@ -533,12 +544,30 @@ export default {
|
|
|
count = dataRules[2].content[0]
|
|
|
}
|
|
|
this.formulaHandleShow = {
|
|
|
- EquipmentMark: data.EquipmentMark,
|
|
|
+ EquipmentMark: eqMark,
|
|
|
cut: cut,
|
|
|
count: count,
|
|
|
extractArr: extractArr
|
|
|
}
|
|
|
break
|
|
|
+ case '需拆分处理':
|
|
|
+ let dataRules = JSON.parse(data.DataRuleContent)
|
|
|
+ let devArr = val.RelationList.map(ele => {
|
|
|
+ let arr = JSON.parse(ele.DataRuleContent)
|
|
|
+ return {
|
|
|
+ EquipmentMark: ele.EquipmentMark,
|
|
|
+ SplitStart: arr[0].content[0].from,
|
|
|
+ SplitEnd: arr[0].content[0].to
|
|
|
+ }
|
|
|
+ })
|
|
|
+ var pointArr = dataRules[1].content
|
|
|
+ this.splitHandleShow = {
|
|
|
+ eqMark: eqMark,
|
|
|
+ EquipmentMark: data.EquipmentMark,
|
|
|
+ pointArr: pointArr,
|
|
|
+ devArr: devArr
|
|
|
+ }
|
|
|
+ break
|
|
|
}
|
|
|
} else {
|
|
|
let dataRules = JSON.parse(data.DataRuleContent)
|
|
@@ -553,6 +582,7 @@ export default {
|
|
|
})
|
|
|
let pointArr = dataRules[1].content
|
|
|
this.splitHandleShow = {
|
|
|
+ eqMark: eqMark,
|
|
|
EquipmentMark: data.EquipmentMark,
|
|
|
pointArr: pointArr,
|
|
|
devArr: devArr
|
|
@@ -563,6 +593,14 @@ export default {
|
|
|
EquipmentMark: eqMark
|
|
|
}
|
|
|
}
|
|
|
+ this.noHandleShow.EquipmentMark = eqMark
|
|
|
+ this.autoHandleShow.EquipmentMark = eqMark
|
|
|
+ this.enumHandleShow.EquipmentMark = eqMark
|
|
|
+ this.enumHandleShow.pointArr = this.enumHandleShow.pointArr?this.enumHandleShow.pointArr:[{from: '',to: ''}]
|
|
|
+ this.formulaHandleShow.EquipmentMark = eqMark
|
|
|
+ this.splitHandleShow.eqMark = eqMark
|
|
|
+ this.splitHandleShow.devArr = this.splitHandleShow.devArr?this.splitHandleShow.devArr:[{EquipmentMark: '',SplitStart: 1,SplitEnd: 1}]
|
|
|
+ this.splitHandleShow.pointArr = this.splitHandleShow.pointArr?this.splitHandleShow.pointArr:[{from: '',to: ''}]
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|