页面新增

This commit is contained in:
pangshenghao
2023-06-05 13:28:33 +08:00
parent dae1f739ea
commit b54501fb43

View File

@@ -0,0 +1,103 @@
<template>
<!--agv单工位-->
<div>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span">指令相关</span>
</div>
<el-form ref="form" :inline="true" :model="form" size="small" label-width="95px">
<el-row>
<el-col :span="8">
<el-form-item label="ip地址" prop="ip_address">
<el-input
v-model="form.ip_address"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<el-button
:loading="false"
icon="el-icon-check"
size="mini"
style="float: right; padding: 6px 9px"
type="primary"
@click="doSubmit"
>保存
</el-button>
</div>
</el-card>
</div>
</template>
<script>
import {
queryDriverConfig,
updateConfig
} from '@/api/acs/device/driverConfig'
import crud from '@/mixins/crud'
export default {
name: 'StandardConveyorControl',
mixins: [crud],
props: {
parentForm: {
type: Object,
require: true
}
},
data() {
return {
form: {
ip_address: ''
}
}
},
created() {
this.$nextTick(() => {
// 从父表单获取设备编码
this.device_id = this.$props.parentForm.device_id
this.device_code = this.$props.parentForm.device_code
queryDriverConfig(this.device_id, this.$props.parentForm.driver_code).then(data => {
// 给表单赋值,并且属性不能为空
if (data.form) {
const arr = Object.keys(data.form)
// 不为空
if (arr.length > 0) {
this.form = data.form
}
}
this.sliceItem()
})
})
},
methods: {
doSubmit() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.configLoading = true
// 根据驱动类型判断是否为路由设备
const parentForm = this.parentForm
parentForm.is_route = true
updateConfig(parentForm, this.form, this.data1, this.data2).then(res => {
this.notify('保存成功', 'success')
this.configLoading = false
}).catch(err => {
this.configLoading = false
console.log(err.response.data.message)
})
}
})
}
}
}
</script>
<style scoped>
</style>