|
|
@@ -0,0 +1,161 @@
|
|
|
+<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-autocomplete prefix-icon="el-icon-search" v-model="formData.cowID" :fetch-suggestions="queryCow" placeholder="请输入牛号" style="width:300px" clearable @select="getNowCow"></el-autocomplete>
|
|
|
+ <!-- <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-input-number v-model="formData.score" :min="0" ></el-input-number>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <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>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import formValidator from '../formValidator'
|
|
|
+import axios from 'axios'
|
|
|
+import { mapState } from 'vuex'
|
|
|
+export default {
|
|
|
+ created() {
|
|
|
+
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ saving: false,
|
|
|
+ formData: {
|
|
|
+ cowID: '',
|
|
|
+ score:""
|
|
|
+ },
|
|
|
+ tableData: [],
|
|
|
+ editRow: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['userInfo', 'allHeight']),
|
|
|
+ pageTitle() {
|
|
|
+ return this.$route.meta.title
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onSave() {
|
|
|
+ if (this.formData.cowID != this.editRow['牛号']) {
|
|
|
+ this.$message({
|
|
|
+ message: '请录入牛只牛号',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.getHaleInfo('wsCow', 'addTk', [
|
|
|
+ this.formData.cowID,this.formData.score,this.userInfo.username
|
|
|
+ ], '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() {
|
|
|
+ this.getCowInfo(this.formData.cowID, 99).then((data) => {
|
|
|
+ // console.log(data)
|
|
|
+ data = this.JsonSort(['牛号', '当前牛舍', '繁殖状态', '泌乳状态', '投喂磁石日期', '投喂磁石人'], data)
|
|
|
+ var list = []
|
|
|
+ Object.keys(data).forEach(item => {
|
|
|
+ list.push({
|
|
|
+ key: item,
|
|
|
+ value: data[item]
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ // console.log(list)
|
|
|
+
|
|
|
+ this.tableData = list
|
|
|
+ this.editRow = data
|
|
|
+
|
|
|
+ }).catch(() => {
|
|
|
+ this.formData.cowID = ''
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+.containMain {
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.contentTitle {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: rgba(0, 0, 0, 1);
|
|
|
+ line-height: 22px;
|
|
|
+ letter-spacing: 1px;
|
|
|
+ padding-bottom: 14px;
|
|
|
+}
|
|
|
+
|
|
|
+.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;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|