|
@@ -75,8 +75,10 @@
|
|
|
>
|
|
|
<a-input
|
|
|
disabled
|
|
|
- style="width: 100%"
|
|
|
+ style="width: 60%"
|
|
|
v-decorator="['positionNum', {rules: [{required: false, message: '点位不能为空'}]}]"/>
|
|
|
+ <a-button type="primary" style="width: 20%" @click="handleAddGroup">采集</a-button>
|
|
|
+ <a-button type="default" style="width: 20%" @click="handleDelGroup">终止</a-button>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
<row-item>
|
|
@@ -387,7 +389,14 @@
|
|
|
|
|
|
<script>
|
|
|
import pick from 'lodash.pick'
|
|
|
-import { addRemoteOpc, updateRemoteOpc, fetchRemoteOpcByPositionNumAndLine } from '@/api/remote/opc'
|
|
|
+import {
|
|
|
+ addRemoteOpc,
|
|
|
+ addRemoteOpcGroup,
|
|
|
+ delRemoteOpcGroup,
|
|
|
+ updateRemoteOpc,
|
|
|
+ fetchRemoteOpcByPositionNumAndLine,
|
|
|
+ fetchRemoteOpc
|
|
|
+} from '@/api/remote/opc'
|
|
|
import SbInfoSelectModal from '@/views/sb/info/modules/SbInfoSelectModal'
|
|
|
import { getSbPositionTree } from '@/api/sb/position'
|
|
|
import ColorModal from './ColorModal'
|
|
@@ -488,6 +497,46 @@ export default {
|
|
|
])))
|
|
|
})
|
|
|
},
|
|
|
+ handleAddGroup () {
|
|
|
+ const { form: { getFieldValue } } = this
|
|
|
+ const id = getFieldValue('id')
|
|
|
+ if (id == null || id === '') {
|
|
|
+ this.$message.error('请先保存点位信息')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fetchRemoteOpc({ id: id }).then(res => {
|
|
|
+ if (res.data.positionNum == null || res.data.positionNum === '') {
|
|
|
+ this.$message.error('请设置点位')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ addRemoteOpcGroup(res.data.positionNum)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.info(res.data)
|
|
|
+ }).catch(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleDelGroup () {
|
|
|
+ const { form: { getFieldValue } } = this
|
|
|
+ const id = getFieldValue('id')
|
|
|
+ if (id == null || id === '') {
|
|
|
+ this.$message.error('请先保存点位信息')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ fetchRemoteOpc({ id: id }).then(res => {
|
|
|
+ if (res.data.positionNum == null || res.data.positionNum === '') {
|
|
|
+ this.$message.error('请设置点位')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ delRemoteOpcGroup(res.data.positionNum)
|
|
|
+ .then((res) => {
|
|
|
+ this.$message.info(res.data)
|
|
|
+ }).catch(() => {
|
|
|
+ this.confirmLoading = false
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
save () {
|
|
|
const { form: { validateFieldsAndScroll } } = this
|
|
|
this.confirmLoading = true
|