|
@@ -1,48 +1,40 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <el-container style="flex-grow:1">
|
|
|
|
|
- <el-main class="containMain">
|
|
|
|
|
- <div class="contentTitle">{{pageTitle}}</div>
|
|
|
|
|
- <el-form ref="form" :model="formData" label-width="80px" style="margin-top:20px;">
|
|
|
|
|
- <el-form-item label="" label-width="0">
|
|
|
|
|
- <el-input v-model="formData.cowID" prefix-icon="el-icon-search" style="width:300px" maxlength="8"></el-input>
|
|
|
|
|
- <el-button type="primary" @click="getNowCow" style="width:90px;margin-left:12px">确认</el-button>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <div class="sub" v-if="tableData.length>0">
|
|
|
|
|
- 操作牛号:{{tableData[0].value}}
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-form-item label="发情症状">
|
|
|
|
|
- <el-select v-model="formData.sign" placeholder="请选择">
|
|
|
|
|
- <el-option v-for="item in signs" :key="item" :label="item" :value="item">
|
|
|
|
|
- </el-option>
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- <el-form-item label="揭发方式">
|
|
|
|
|
- <el-select v-model="formData.method" placeholder="请选择">
|
|
|
|
|
- <el-option v-for="item in methods" :key="item" :label="item" :value="item">
|
|
|
|
|
- </el-option>
|
|
|
|
|
- </el-select>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
|
+ <el-container style="flex-grow:1">
|
|
|
|
|
+ <el-main class="containMain">
|
|
|
|
|
+ <div class="contentTitle">{{pageTitle}}</div>
|
|
|
|
|
+ <el-form ref="form" :model="formData" label-width="80px" style="margin-top:20px;">
|
|
|
|
|
+ <el-form-item label label-width="0">
|
|
|
|
|
+ <el-autocomplete prefix-icon="el-icon-search" v-model="formData.cowID" :fetch-suggestions="queryCow" placeholder="请输入牛号" style="width:300px" clearable @select="getNowCow"></el-autocomplete>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <div class="sub" v-if="tableData.length>0">操作牛号:{{tableData[0].value}}</div>
|
|
|
|
|
+ <el-form-item label="发情症状">
|
|
|
|
|
+ <el-select v-model="formData.sign" placeholder="请选择">
|
|
|
|
|
+ <el-option v-for="item in signs" :key="item" :label="item" :value="item"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="揭发方式">
|
|
|
|
|
+ <el-select v-model="formData.method" placeholder="请选择">
|
|
|
|
|
+ <el-option v-for="item in methods" :key="item" :label="item" :value="item"></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
|
|
|
- <div style="margin-top:80px">
|
|
|
|
|
- <el-button @click="onSave" type="primary" style="width:98px;" size="mediu">确认保存</el-button>
|
|
|
|
|
|
|
+ <div style="margin-top:80px">
|
|
|
|
|
+ <el-button @click="onSave" type="primary" style="width:98px;" size="mediu">确认保存</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ </el-main>
|
|
|
|
|
+ <el-aside class="containAside" width="450px">
|
|
|
|
|
+ <div class="asideInfo">
|
|
|
|
|
+ <div class="contentTitle">牛只信息</div>
|
|
|
|
|
+ <el-table class="handleTable" border :data="tableData" style="width: 100%" :height="(allHeight-70)+'px'" size="small">
|
|
|
|
|
+ <el-table-column prop="key" label="参数"></el-table-column>
|
|
|
|
|
+ <el-table-column prop="value" label="当前牛只信信息"></el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-aside>
|
|
|
|
|
+ </el-container>
|
|
|
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- </el-main>
|
|
|
|
|
- <el-aside class="containAside" width="450px">
|
|
|
|
|
- <div class="asideInfo">
|
|
|
|
|
- <div class="contentTitle">牛只信息</div>
|
|
|
|
|
- <el-table class="handleTable" border :data="tableData" style="width: 100%" :height="(allHeight-70)+'px'" size='small'>
|
|
|
|
|
- <el-table-column prop="key" label="参数">
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column prop="value" label="当前牛只信信息">
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </el-table>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-aside>
|
|
|
|
|
- </el-container>
|
|
|
|
|
-
|
|
|
|
|
- <!-- <div>
|
|
|
|
|
|
|
+ <!-- <div>
|
|
|
<el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small"
|
|
<el-form :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small"
|
|
|
style="max-width: 500px;">
|
|
style="max-width: 500px;">
|
|
|
<el-form-item prop="icon" label="头像">
|
|
<el-form-item prop="icon" label="头像">
|
|
@@ -93,178 +85,175 @@
|
|
|
<el-button @click="$router.go(-1)">取消</el-button>
|
|
<el-button @click="$router.go(-1)">取消</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
- </div> -->
|
|
|
|
|
|
|
+ </div>-->
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
import formValidator from '../formValidator'
|
|
import formValidator from '../formValidator'
|
|
|
import axios from 'axios'
|
|
import axios from 'axios'
|
|
|
import { mapState } from 'vuex'
|
|
import { mapState } from 'vuex'
|
|
|
export default {
|
|
export default {
|
|
|
- created() {
|
|
|
|
|
|
|
+ created() {
|
|
|
|
|
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- saving: false,
|
|
|
|
|
- formData: {
|
|
|
|
|
- cowID: '',
|
|
|
|
|
- sign: '明显',
|
|
|
|
|
- method: '人工观察',
|
|
|
|
|
- },
|
|
|
|
|
- signs: ['明显', '不明显', '正常'],
|
|
|
|
|
- methods: ['人工观察', '计步器揭发', '同期发情'],
|
|
|
|
|
- tableData: []
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ saving: false,
|
|
|
|
|
+ formData: {
|
|
|
|
|
+ cowID: '',
|
|
|
|
|
+ sign: '明显',
|
|
|
|
|
+ method: '人工观察',
|
|
|
|
|
+ },
|
|
|
|
|
+ signs: ['明显', '不明显', '正常'],
|
|
|
|
|
+ methods: ['人工观察', '计步器揭发', '同期发情'],
|
|
|
|
|
+ tableData: [],
|
|
|
|
|
+ editInfo: {}
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ ...mapState(['userInfo', 'allHeight']),
|
|
|
|
|
+ reasons() {
|
|
|
|
|
+ var list = []
|
|
|
|
|
+ this.allReason.forEach(item => {
|
|
|
|
|
+ if (list.indexOf(item['类别']) == -1) {
|
|
|
|
|
+ list.push(item['类别'])
|
|
|
}
|
|
}
|
|
|
|
|
+ })
|
|
|
|
|
+ return list
|
|
|
},
|
|
},
|
|
|
- computed: {
|
|
|
|
|
- ...mapState(['userInfo', 'allHeight']),
|
|
|
|
|
- reasons() {
|
|
|
|
|
- var list = []
|
|
|
|
|
- this.allReason.forEach(item => {
|
|
|
|
|
- if (list.indexOf(item['类别']) == -1) {
|
|
|
|
|
- list.push(item['类别'])
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- return list
|
|
|
|
|
- },
|
|
|
|
|
- remarks() {
|
|
|
|
|
- var list = []
|
|
|
|
|
- if (this.formData.reason) {
|
|
|
|
|
- this.allReason.forEach(item => {
|
|
|
|
|
- if (item['类别'] == this.formData.reason) {
|
|
|
|
|
- list.push(item['名称'])
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- return list
|
|
|
|
|
- },
|
|
|
|
|
- pageTitle() {
|
|
|
|
|
- return this.$route.meta.title
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ remarks() {
|
|
|
|
|
+ var list = []
|
|
|
|
|
+ if (this.formData.reason) {
|
|
|
|
|
+ this.allReason.forEach(item => {
|
|
|
|
|
+ if (item['类别'] == this.formData.reason) {
|
|
|
|
|
+ list.push(item['名称'])
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ return list
|
|
|
},
|
|
},
|
|
|
- watch: {
|
|
|
|
|
- 'formData.reason'() {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- this.formData.remark = this.remarks[0]
|
|
|
|
|
- }, 100)
|
|
|
|
|
- },
|
|
|
|
|
- 'formData.cowID'() {
|
|
|
|
|
- if (this.formData.cowID.length != 8) {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- this.getNowCow()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ pageTitle() {
|
|
|
|
|
+ return this.$route.meta.title
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ 'formData.reason'() {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ this.formData.remark = this.remarks[0]
|
|
|
|
|
+ }, 100)
|
|
|
},
|
|
},
|
|
|
- methods: {
|
|
|
|
|
- onSave() {
|
|
|
|
|
- if (!this.formData.cowID) {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: '请录入牛只牛号',
|
|
|
|
|
- type: 'warning'
|
|
|
|
|
- });
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- this.formData.operators = this.userInfo.username
|
|
|
|
|
|
|
|
|
|
- this.getHaleInfo('wsBreeding', 'addHeatingInfo', [{
|
|
|
|
|
- cowID: this.formData.cowID,
|
|
|
|
|
- heatingDate: Date.parse(new Date()),
|
|
|
|
|
- heatingCase: this.formData.sign,
|
|
|
|
|
- exposeMode: this.formData.method
|
|
|
|
|
- }], 'json').then((data) => {
|
|
|
|
|
- console.log(data)
|
|
|
|
|
- if (data.rtnCode == -1) {
|
|
|
|
|
- // this.$message({
|
|
|
|
|
- // message: data.rtnMessage,
|
|
|
|
|
- // type: 'warning'
|
|
|
|
|
- // });
|
|
|
|
|
- this.$alert(data.rtnMessage, '提示', {
|
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
|
- callback: action => {
|
|
|
|
|
- this.formData.cowID = ''
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- this.$message({
|
|
|
|
|
- message: '录入成功',
|
|
|
|
|
- type: 'success'
|
|
|
|
|
- });
|
|
|
|
|
- this.formData.cowID = ''
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- getNowCow() {
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ onSave() {
|
|
|
|
|
+ if (this.formData.cowID != this.editInfo['牛号']) {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '请录入牛只牛号',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ this.formData.operators = this.userInfo.username
|
|
|
|
|
|
|
|
- this.getCowInfo(this.formData.cowID, 2).then((data) => {
|
|
|
|
|
- // console.log(data)
|
|
|
|
|
- var list = []
|
|
|
|
|
- Object.keys(data).forEach(item => {
|
|
|
|
|
- list.push({
|
|
|
|
|
- key: item,
|
|
|
|
|
- value: data[item]
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ this.getHaleInfo('wsBreeding', 'addHeatingInfo', [{
|
|
|
|
|
+ cowID: this.formData.cowID,
|
|
|
|
|
+ heatingDate: Date.parse(new Date()),
|
|
|
|
|
+ heatingCase: this.formData.sign,
|
|
|
|
|
+ exposeMode: this.formData.method
|
|
|
|
|
+ }], 'json').then((data) => {
|
|
|
|
|
+ console.log(data)
|
|
|
|
|
+ if (data.rtnCode == -1) {
|
|
|
|
|
+ // this.$message({
|
|
|
|
|
+ // message: data.rtnMessage,
|
|
|
|
|
+ // type: 'warning'
|
|
|
|
|
+ // });
|
|
|
|
|
+ this.$alert(data.rtnMessage, '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ callback: action => {
|
|
|
|
|
+ this.formData.cowID = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ message: '录入成功',
|
|
|
|
|
+ type: 'success'
|
|
|
|
|
+ });
|
|
|
|
|
+ this.formData.cowID = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ getNowCow() {
|
|
|
|
|
|
|
|
- // console.log(list)
|
|
|
|
|
|
|
+ this.getCowInfo(this.formData.cowID, 2).then((data) => {
|
|
|
|
|
+ // console.log(data)
|
|
|
|
|
+ var list = []
|
|
|
|
|
+ Object.keys(data).forEach(item => {
|
|
|
|
|
+ list.push({
|
|
|
|
|
+ key: item,
|
|
|
|
|
+ value: data[item]
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
- this.tableData = list
|
|
|
|
|
- if (data['繁殖状态'] == '复检有胎' || data['繁殖状态'] == '初检已孕') {
|
|
|
|
|
- this.$alert('当前牛号已经有胎,不允许录入发情信息。(可以通过数据更正方式重置上次的妊检结果为未孕或无胎,再进行操作)', '提示', {
|
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
|
- callback: action => {
|
|
|
|
|
- this.formData.cowID = ''
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(() => {
|
|
|
|
|
- this.formData.cowID = ''
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // console.log(list)
|
|
|
|
|
+ this.editInfo = data
|
|
|
|
|
+ this.tableData = list
|
|
|
|
|
+ if (data['繁殖状态'] == '复检有胎' || data['繁殖状态'] == '初检已孕') {
|
|
|
|
|
+ this.$alert('当前牛号已经有胎,不允许录入发情信息。(可以通过数据更正方式重置上次的妊检结果为未孕或无胎,再进行操作)', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ callback: action => {
|
|
|
|
|
+ this.formData.cowID = ''
|
|
|
|
|
+ this.editInfo = {}
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.formData.cowID = ''
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|
|
|
.containMain {
|
|
.containMain {
|
|
|
- background: rgba(255, 255, 255, 1);
|
|
|
|
|
- border-radius: 4px;
|
|
|
|
|
- padding: 15px;
|
|
|
|
|
- // margin-right: 10px;
|
|
|
|
|
- .contentTitle {
|
|
|
|
|
- border-bottom: 1px solid #f2f4f5;
|
|
|
|
|
- }
|
|
|
|
|
- // min-width: 450px;
|
|
|
|
|
|
|
+ background: rgba(255, 255, 255, 1);
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ padding: 15px;
|
|
|
|
|
+ // margin-right: 10px;
|
|
|
|
|
+ .contentTitle {
|
|
|
|
|
+ border-bottom: 1px solid #f2f4f5;
|
|
|
|
|
+ }
|
|
|
|
|
+ // min-width: 450px;
|
|
|
|
|
|
|
|
- .sub {
|
|
|
|
|
- font-size: 14px;
|
|
|
|
|
- font-weight: 600;
|
|
|
|
|
- color: rgba(102, 102, 102, 1);
|
|
|
|
|
- line-height: 20px;
|
|
|
|
|
- margin-bottom: 40px;
|
|
|
|
|
- padding-left: 20px;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .sub {
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ color: rgba(102, 102, 102, 1);
|
|
|
|
|
+ line-height: 20px;
|
|
|
|
|
+ margin-bottom: 40px;
|
|
|
|
|
+ padding-left: 20px;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.contentTitle {
|
|
.contentTitle {
|
|
|
- font-size: 16px;
|
|
|
|
|
- font-weight: bold;
|
|
|
|
|
- color: rgba(0, 0, 0, 1);
|
|
|
|
|
- line-height: 22px;
|
|
|
|
|
- letter-spacing: 1px;
|
|
|
|
|
- padding-bottom: 14px;
|
|
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ color: rgba(0, 0, 0, 1);
|
|
|
|
|
+ line-height: 22px;
|
|
|
|
|
+ letter-spacing: 1px;
|
|
|
|
|
+ padding-bottom: 14px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.containAside {
|
|
.containAside {
|
|
|
- padding: 0;
|
|
|
|
|
- margin-left: 10px;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- flex-direction: column;
|
|
|
|
|
- .asideInfo {
|
|
|
|
|
- flex-grow: 1;
|
|
|
|
|
- background: rgba(255, 255, 255, 1);
|
|
|
|
|
- border-radius: 4px;
|
|
|
|
|
- padding: 15px;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ padding: 0;
|
|
|
|
|
+ margin-left: 10px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-direction: column;
|
|
|
|
|
+ .asideInfo {
|
|
|
|
|
+ flex-grow: 1;
|
|
|
|
|
+ background: rgba(255, 255, 255, 1);
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ padding: 15px;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|