1
0
panhui 7 лет назад
Родитель
Сommit
d3f72f6084

+ 5 - 5
src/main/vue/src/entries/admin.js

@@ -176,13 +176,12 @@ Vue.prototype.getHaleInfo = function(serviceName, methodName, params, type, key,
             var jsonp = {}
             var list = []
             if (res.data.data.key) {
-                if (type == list) {
+                if (type == 'list') {
                     resolve([])
                 } else {
                     resolve({})
                 }
-            }
-            if (type == 'list') {
+            } else if (type == 'list') {
                 //list处理
 
 
@@ -202,16 +201,17 @@ Vue.prototype.getHaleInfo = function(serviceName, methodName, params, type, key,
 
                 resolve(list)
 
-            }
-            if (type == 'json') {
+            } else if (type == 'json') {
                 jsonp = res.data.data
                 for (var key in jsonp) {
                     if (key.indexOf('日期') != -1) {
                         jsonp[key] = format(new Date(jsonp[key]), dateType ? dateType : 'YYYY-MM-DD', { locale: zh })
                     }
                 }
+                console.log(jsonp)
                 resolve(jsonp)
             }
+
         })
     })
 }

+ 270 - 0
src/main/vue/src/pages/HandleEstrusEvent.vue

@@ -0,0 +1,270 @@
+<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>
+
+                <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 :model="formData" :rules="rules" ref="form" label-width="80px" label-position="right" size="small"
+                 style="max-width: 500px;">
+            <el-form-item prop="icon" label="头像">
+                <single-upload v-model="formData.icon"></single-upload>
+            </el-form-item>
+            <el-form-item prop="username" label="用户名">
+                <el-input v-model="formData.username"></el-input>
+            </el-form-item>
+            <el-form-item prop="phone" label="手机">
+                <el-input v-model="formData.phone"></el-input>
+            </el-form-item>
+            <el-form-item prop="phone" label="密码" v-if="!$route.query.id">
+                <el-input v-model="formData.password"></el-input>
+            </el-form-item>
+            <el-form-item prop="roleId" label="角色">
+                <el-select v-model="formData.roleId" multiple placeholder="请选择" style="width: 100%;">
+                    <el-option
+                        v-for="item in roles"
+                        :key="item.id"
+                        :label="item.name"
+                        :value="item.id">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item prop="departId" label="部门">
+                <el-cascader
+                    :options="departs"
+                    v-model="formData.departId">
+                </el-cascader>
+            </el-form-item>
+            <el-form-item prop="birthday" label="生日">
+                <el-date-picker
+                    v-model="formData.birthday"
+                    format="yyyy-MM-dd"
+                    value-format="timestamp">
+                </el-date-picker>
+            </el-form-item>
+            <el-form-item prop="createTime" label="创建时间">
+                <el-date-picker
+                    v-model="formData.createTime"
+                    type="datetime"
+                    format="yyyy-MM-dd HH:mm:ss"
+                    value-format="timestamp">
+                </el-date-picker>
+            </el-form-item>
+            <el-form-item>
+                <el-button @click="onSave" :loading="$store.state.fetchingData" type="primary">保存</el-button>
+                <el-button @click="$router.go(-1)">取消</el-button>
+            </el-form-item>
+        </el-form>
+    </div> -->
+</template>
+<script>
+import formValidator from '../formValidator'
+import axios from 'axios'
+import { mapState } from 'vuex'
+export default {
+    created() {
+
+
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {
+                cowID: '',
+                sign: '明显',
+                method: '人工观察',
+            },
+            signs: ['明显', '不明显', '正常'],
+            methods: ['人工观察', '计步器揭发', '同期发情'],
+            tableData: []
+        }
+    },
+    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
+        }
+    },
+    watch: {
+        'formData.reason'() {
+            setTimeout(() => {
+                this.formData.remark = this.remarks[0]
+            }, 100)
+        },
+        'formData.cowID'() {
+            if (this.formData.cowID.length != 8) {
+                return
+            }
+            this.getNowCow()
+        }
+    },
+    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() {
+
+            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]
+                    })
+                })
+
+                // console.log(list)
+
+                this.tableData = list
+                if (data['繁殖状态'] == '复检有胎' || data['繁殖状态'] == '初检已孕') {
+                    this.$alert('当前牛号已经有胎,不允许录入发情信息。(可以通过数据更正方式重置上次的妊检结果为未孕或无胎,再进行操作)', '提示', {
+                        confirmButtonText: '确定',
+                        callback: action => {
+                            this.formData.cowID = ''
+                        }
+                    });
+                }
+            }).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>

+ 322 - 0
src/main/vue/src/pages/HandleMatch.vue

@@ -0,0 +1,322 @@
+<template>
+    <el-container style="flex-grow:1">
+        <el-aside class="containAside" width="500px" style=" margin-right: 10px;">
+            <div class="asideInfo">
+                <div class="contentTitle">{{pageTitle}}
+
+                    <span>{{list.length}}头奶牛</span>
+                </div>
+                <el-table class="handleTable" border :data="list" style="width: 100%" :height='(allHeight-70)+"px"' size='small'>
+                    <el-table-column prop="牛号" label="牛号" fixed="left" align="center">
+                    </el-table-column>
+                    <el-table-column prop="当前牛舍" label="牛舍" align="center">
+                    </el-table-column>
+                    <el-table-column prop="发情观察日期" label="发情日期" align="center">
+                    </el-table-column>
+                    <el-table-column prop="繁殖状态" label="繁殖状态" align="center">
+                    </el-table-column>
+                    <el-table-column prop="最近配种" label="最近配种" align="center">
+                    </el-table-column>
+                    <el-table-column prop="不建议配种原因" label="不建议配种原因" align="center">
+                    </el-table-column>
+                </el-table>
+            </div>
+        </el-aside>
+        <el-main class="containMain">
+            <div class="contentTitle">配种信息登记</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-radio-group v-model="formData.isMate">
+                        <el-radio label="0">是</el-radio>
+                        <el-radio label="1">否</el-radio>
+                    </el-radio-group>
+                </el-form-item>
+                <el-form-item label="配种方式">
+                    <el-select v-model="formData.mateMode" placeholder="请选择">
+                        <el-option v-for="item in mateModes" :key="item['详细方式']" :label="item['详细方式']" :value="item['详细方式']">
+                        </el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="配种冻精">
+                    <el-select v-model="formData.bull" placeholder="请选择">
+                        <el-option v-for="item in bulls" :key="item['牛号']" :label="item['牛号']" :value="item['牛号']">
+                        </el-option>
+                    </el-select>
+
+                    <div>
+                        <el-popover placement="right" width="200" trigger="hover">
+                            <div class="conetnt">
+                                <div class="item" v-for="(item,key) in bullMsg">
+                                    <div class="item-title">{{key}}</div>
+                                    <div class="text">{{item}}</div>
+                                </div>
+                            </div>
+                            <el-button type="text" slot="reference">查看此冻精详情</el-button>
+                        </el-popover>
+                    </div>
+                </el-form-item>
+
+                 <el-form-item label="配种员">
+                    <el-select v-model="formData.person" placeholder="请选择">
+                        <el-option v-for="item in [userInfo.username]" :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>
+            </el-form>
+        </el-main>
+        <el-aside class="containAside" width="450px" style=" margin-left: 10px;">
+            <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() {
+        //配种列表
+        this.getHaleInfo('wsBreeding', 'getMateDataTask', [
+            this.$store.state.farmName
+        ], 'list').then((data) => {
+            console.log(data)
+            this.list = data
+
+        })
+        //配种方式
+        this.getHaleInfo('wsCow', 'getUserDict', ['MateMode'], 'list').then((data) => {
+            this.mateModes = data
+            this.formData.mateMode = data[0]['详细方式']
+        })
+        //冻精列表
+        this.getHaleInfo('wsCow', 'getAllBullByFarmName', [
+            this.$store.state.farmName, true
+        ], 'list').then((data) => {
+            this.bulls = data
+        })
+
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {
+                cowID: '',
+                isMate: '0',
+                mateMode: '',
+                bull: '',
+                person:'',
+            },
+            mateModes: [],
+            methods: ['人工观察', '计步器揭发', '同期发情'],
+            bulls: [],
+            tableData: [],
+            list: []
+        }
+    },
+    computed: {
+        ...mapState(['userInfo', 'allHeight']),
+        pageTitle() {
+            return this.$route.meta.title
+        },
+        bullMsg() {
+            var jsonp = {}
+            if (this.formData.bull) {
+                this.bulls.forEach(item => {
+                    if (item['牛号'] == this.formData.bull) {
+                        jsonp = item
+                    }
+                })
+            }
+
+            return jsonp
+
+
+        }
+    },
+    watch: {
+        'formData.reason'() {
+            setTimeout(() => {
+                this.formData.remark = this.remarks[0]
+            }, 100)
+        },
+        'formData.cowID'() {
+            if (this.formData.cowID.length != 8) {
+                return
+            }
+            this.getNowCow()
+        }
+    },
+    methods: {
+        onSave() {
+            if (!this.formData.cowID) {
+                this.$message({
+                    message: '请录入牛只牛号',
+                    type: 'warning'
+                });
+                return
+            }
+
+            if (!this.formData.bull) {
+                this.$message({
+                    message: '请选择冻精',
+                    type: 'warning'
+                });
+                return
+            }
+
+            if (!this.formData.person) {
+                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() {
+
+            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]
+                    })
+                })
+
+                // console.log(list)
+
+                this.tableData = list
+                if (data['繁殖状态'] == '复检有胎' || data['繁殖状态'] == '初检已孕') {
+                    this.$alert('当前牛号已经有胎,不允许录入配种信息,但目前允许选择冻精进行数据查看等。(可通过数据更正方式重置上次的妊检结果为未孕或无胎,再进行操作)', '提示', {
+                        confirmButtonText: '确定',
+                        callback: action => {
+                            this.formData.cowID = ''
+                        }
+                    });
+                }
+            }).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;
+    span {
+        font-size: 13px;
+        color: rgba(102, 102, 102, 1);
+        line-height: 18px;
+        margin-left: 10px;
+    }
+}
+
+.containAside {
+    padding: 0;
+
+    display: flex;
+    flex-direction: column;
+    .asideInfo {
+        flex-grow: 1;
+        background: rgba(255, 255, 255, 1);
+        border-radius: 4px;
+        padding: 15px;
+    }
+}
+
+.item {
+    .item-title {
+        font-size: 14px;
+        font-weight: bold;
+
+        color: rgba(0, 0, 0, 1);
+        line-height: 20px;
+        letter-spacing: 1px;
+    }
+
+    .text {
+        font-size: 13px;
+        color: rgba(0, 0, 0, 1);
+        line-height: 18px;
+        letter-spacing: 1px;
+        word-wrap:break-word ;
+        padding: 10px 0 15px;
+    }
+}
+</style>

+ 4 - 2
src/main/vue/src/pages/TestAaa.vue

@@ -277,7 +277,8 @@ export default {
             }).then(res => {
                 if (res.success) {
                     this.$message.success('成功');
-                    this.$router.go(-1);
+                    // this.$router.go(-1);
+                    this.$emit('changeEdit')
                 } else {
                     this.$message.warning('失败')
                 }
@@ -291,7 +292,8 @@ export default {
                 })
             }).then(() => {
                 this.$message.success('删除成功');
-                this.$router.go(-1);
+                // this.$router.go(-1);
+                 this.$emit('changeEdit')
             }).catch(action => {
                 if (action === 'cancel') {
                     this.$message.info('删除取消');

+ 17 - 4
src/main/vue/src/pages/TestAaas.vue

@@ -175,7 +175,7 @@
             <img width="100%" :src="imgSrc" alt="">
         </el-dialog>
         <el-dialog title="编辑test_aaa" top='10px' :visible.sync="editDialogVisible">
-            <testAaa :formData='editRowInfo' @changeEditDialogVisible='changeEditDialogVisible'></testAaa>
+            <testAaa :formData='editRowInfo' @changeEditDialogVisible='changeEditDialogVisible' @changeEdit='changeEdit'></testAaa>
         </el-dialog>
 
     </div>
@@ -322,14 +322,18 @@ export default {
         }
     },
     computed: {
-        ...mapState(['tableHeight']),
+        ...mapState(['tableHeight','userInfo']),
         selection() {
             return this.$refs.table.selection.map(i => i.id);
         }
     },
     methods: {
-        changeEditDialogVisible(value){
-            this.editDialogVisible=value
+        changeEditDialogVisible(value) {
+            this.editDialogVisible = value
+        },
+        changeEdit() {
+            this.editDialogVisible = false
+            this.getData();
         },
         pageSizeChange(size) {
             this.currentPage = 1;
@@ -389,6 +393,15 @@ export default {
             } else {
                 jsonp.multiSelect = [];
             }
+            jsonp.loginUser = this.userInfo.username;
+
+            jsonp.testcTime = format(new Date(), 'YYYY/MM/DD HH:mm', { locale: zh });
+
+            jsonp.testcDate = format(new Date(), 'YYYY/MM/DD', { locale: zh });
+
+            jsonp.workNumber = this.userInfo.workNumber;
+
+            jsonp.departId = this.userInfo.departId;
             this.editRowInfo = jsonp
             this.editDialogVisible = true
         },

+ 24 - 0
src/main/vue/src/router/index.js

@@ -343,6 +343,30 @@ const router = new Router({
                         type: '手持机录入',
                         title: '离场登记'
                     }
+                },
+                /**INSERT_LOCATION**/
+
+                {
+                    path: '/handleEstrusEvent',
+                    name: 'handleEstrusEvent',
+                    component: () =>
+                        import ('../pages/HandleEstrusEvent'),
+                    meta: {
+                        type: '手持机录入',
+                        title: '发情事件'
+                    }
+                },
+                /**INSERT_LOCATION**/
+
+                {
+                    path: '/handleMatch',
+                    name: 'handleMatch',
+                    component: () =>
+                        import ('../pages/HandleMatch'),
+                    meta: {
+                        type: '手持机录入',
+                        title: '配种任务'
+                    }
                 }
             ]
         },

+ 1 - 1
src/main/vue/src/vuex/index.js

@@ -9,7 +9,7 @@ export default new Vuex.Store({
         allHeight: 0,
         fetchingData: false,
         userInfo: null,
-        farmName: '金',
+        farmName: '金',
         loginHistory: [{
             name: '/dashboard',
             title: '首页'