|
@@ -12,17 +12,20 @@
|
|
|
label-width="80px"
|
|
|
size="mini"
|
|
|
style="margin-left: 20px;width: 500px">
|
|
|
- <el-form-item label="参数名称" prop="thresholdType">
|
|
|
+ <el-form-item label="所属范围" prop="belongTo">
|
|
|
<!-- <el-input v-model.number="dataForm.thresholdType" placeholder="请输入数字"></el-input> -->
|
|
|
- <el-select v-model="dataForm.thresholdType" style="width: 100%" :disabled="dataForm.id > 0">
|
|
|
+ <el-select v-model="dataForm.belongTo" style="width: 100%">
|
|
|
<el-option
|
|
|
- v-for="item in thresholdTypes"
|
|
|
+ v-for="item in belongTo"
|
|
|
:key="item.value"
|
|
|
:label="item.label"
|
|
|
:value="item.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="参数名称" prop="thresholdType">
|
|
|
+ <el-input v-model="dataForm.thresholdType"></el-input>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="参数阈值" prop="thresholdValue">
|
|
|
<el-input v-model="dataForm.thresholdValue"></el-input>
|
|
|
</el-form-item>
|
|
@@ -35,20 +38,40 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { isEmail, isMobile } from '@/utils/validate'
|
|
|
export default {
|
|
|
- props: ["thresholdTypes"],
|
|
|
+ props: ["belongTo"],
|
|
|
data () {
|
|
|
return {
|
|
|
visible: false,
|
|
|
dataForm: {
|
|
|
id: '',
|
|
|
- thresholdName: '',
|
|
|
+ belongTo: '',
|
|
|
thresholdType: '',
|
|
|
thresholdValue: '',
|
|
|
// farmId: ''
|
|
|
},
|
|
|
+ // belongTo: [
|
|
|
+ // {
|
|
|
+ // label: '室内',
|
|
|
+ // value: 1
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '室外',
|
|
|
+ // value: 2
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '耳标数据',
|
|
|
+ // value: 3
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: '饮用水',
|
|
|
+ // value: 4
|
|
|
+ // }
|
|
|
+ // ],
|
|
|
dataRule: {
|
|
|
+ belongTo: [
|
|
|
+ { required: true, message: '参数范围不能为空', trigger: 'blur' }
|
|
|
+ ],
|
|
|
thresholdType: [
|
|
|
{ required: true, message: '参数名称不能为空', trigger: 'blur' }
|
|
|
],
|
|
@@ -76,6 +99,7 @@
|
|
|
}).then(({data}) => {
|
|
|
if (data && data.code === 0) {
|
|
|
// console.log(data)
|
|
|
+ this.dataForm.belongTo = data.thresholdManagement.belongTo
|
|
|
this.dataForm.thresholdType = data.thresholdManagement.thresholdType
|
|
|
this.dataForm.thresholdValue = data.thresholdManagement.thresholdValue
|
|
|
// this.dataForm.farmId = data.thresholdManagement.farmId
|
|
@@ -87,18 +111,18 @@
|
|
|
dataFormSubmit () {
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- let belong = {
|
|
|
- '1': 1,
|
|
|
- '2': 1,
|
|
|
- '3': 1,
|
|
|
- '4': 4,
|
|
|
- '5': 2,
|
|
|
- '6': 2,
|
|
|
- '7': 2,
|
|
|
- '8': 3,
|
|
|
- '9': 3,
|
|
|
- '10': 3
|
|
|
- }
|
|
|
+ // let belong = {
|
|
|
+ // '1': 1,
|
|
|
+ // '2': 1,
|
|
|
+ // '3': 1,
|
|
|
+ // '4': 4,
|
|
|
+ // '5': 2,
|
|
|
+ // '6': 2,
|
|
|
+ // '7': 2,
|
|
|
+ // '8': 3,
|
|
|
+ // '9': 3,
|
|
|
+ // '10': 3
|
|
|
+ // }
|
|
|
this.$http({
|
|
|
url: this.$http.adornUrl(`/management/thresholdManagement/${!this.dataForm.id ? 'save' : 'update'}`),
|
|
|
method: 'post',
|
|
@@ -107,7 +131,7 @@
|
|
|
'thresholdType': this.dataForm.thresholdType,
|
|
|
'thresholdValue': this.dataForm.thresholdValue,
|
|
|
'farmId': parseInt(this.$cookie.get('formFarmId')),
|
|
|
- 'belongTo': belong[this.dataForm.thresholdType.toString()]
|
|
|
+ 'belongTo': this.dataForm.belongTo
|
|
|
})
|
|
|
}).then(({data}) => {
|
|
|
if (data && data.code === 0) {
|