|
|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<el-container style="flex-grow:1">
|
|
|
- <el-aside class="containAside" max-width="500px" width='26%' style=" margin-right: 10px;">
|
|
|
+ <el-aside class="containAside" max-width="500px" width="26%" style=" margin-right: 10px;">
|
|
|
<div class="asideInfo">
|
|
|
<div class="contentTitle">
|
|
|
{{pageTitle}}
|
|
|
@@ -26,12 +26,29 @@
|
|
|
</div>
|
|
|
</el-aside>
|
|
|
<el-main class="containMain">
|
|
|
- <div class="contentTitle">{{pageTitle}}</div>
|
|
|
+ <div class="contentTitle">
|
|
|
+ {{pageTitle}}
|
|
|
+ <el-button type="info" v-if="!isBatch" style="float:right" size="mini" @click="isBatch=true" plain>批量确诊</el-button>
|
|
|
+ <el-button type="primary" v-else style="float:right" size="mini" @click="isBatch=false" icon="el-icon-check">批量确诊</el-button>
|
|
|
+ </div>
|
|
|
<el-form ref="form" :model="formData" label-width="80px" style="margin-top:20px;width:522px;">
|
|
|
- <el-form-item label label-width="0">
|
|
|
- <el-autocomplete v-model="formData.cowID" :fetch-suggestions="querySearchAsync" style="width:200px" clearable placeholder="请输入内容" @select="chooseCow"></el-autocomplete>
|
|
|
+ <el-form-item label label-width="0" v-if="!isBatch">
|
|
|
+ <el-autocomplete v-model="formData.cowID" :fetch-suggestions="querySearchAsync" style="width:200px" clearable placeholder="请输入牛号" @select="chooseCow"></el-autocomplete>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label label-width="0" v-else>
|
|
|
+ <el-autocomplete prefix-icon="el-icon-search" v-model="cowID" :fetch-suggestions="queryCow" placeholder="请输入批量牛号" style="width:300px" clearable @select="getNowCow"></el-autocomplete>
|
|
|
</el-form-item>
|
|
|
- <div class="sub" v-if="tableData.length>0">操作牛号:{{editCowInfo['牛号']}}</div>
|
|
|
+ <div class="sub" v-if="tableData.length>0&&!isBatch">操作牛号:{{editCowInfo['牛号']}}</div>
|
|
|
+
|
|
|
+ <el-card v-if="isBatch&&cowList.length>0" style="margin-bottom:20px">
|
|
|
+ <div style="flex-wrap: wrap;display:flex;">
|
|
|
+ <div class="chooseItem" v-for="(item,index) in cowList" style="margin-bottom:10px">
|
|
|
+ <span>{{item['牛号']}}</span>
|
|
|
+ <i class="el-icon-error" @click="delCow(index)"></i>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-card>
|
|
|
+
|
|
|
<el-form-item label="发病日期">
|
|
|
<el-input v-model="formData.diseaseDate" disabled style="width:217px"></el-input>
|
|
|
</el-form-item>
|
|
|
@@ -114,7 +131,7 @@
|
|
|
</div>
|
|
|
</el-form>
|
|
|
</el-main>
|
|
|
- <el-aside class="containAside" max-width="450px" width='25%'>
|
|
|
+ <el-aside class="containAside" max-width="450px" width="25%">
|
|
|
<div class="asideInfo">
|
|
|
<div class="contentTitle">牛只信息</div>
|
|
|
<el-table class="handleTable" border :data="tableData" style="width: 100%" :height="(allHeight-70)+'px'" size="small">
|
|
|
@@ -213,7 +230,10 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ cowID: '',
|
|
|
+ cowList: [],
|
|
|
saving: false,
|
|
|
+ isBatch: false,
|
|
|
formData: {
|
|
|
"cowID": '',
|
|
|
"diseaseDate": '',
|
|
|
@@ -404,18 +424,25 @@ export default {
|
|
|
return list
|
|
|
|
|
|
},
|
|
|
- allCowList(){
|
|
|
- var list=[]
|
|
|
- this.list.forEach(item=>{
|
|
|
- var jsonp={...item}
|
|
|
- jsonp.value=item['牛号']
|
|
|
+ allCowList() {
|
|
|
+ var list = []
|
|
|
+ this.list.forEach(item => {
|
|
|
+ var jsonp = { ...item }
|
|
|
+ jsonp.value = item['牛号']
|
|
|
list.push(jsonp)
|
|
|
})
|
|
|
return list
|
|
|
+ },
|
|
|
+ chooseList() {
|
|
|
+ var list = []
|
|
|
+ this.cowList.forEach(item => {
|
|
|
+ list.push(item['牛号'])
|
|
|
+ })
|
|
|
+ return list
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
-
|
|
|
+
|
|
|
'formData.num'() {
|
|
|
setTimeout(() => {
|
|
|
this.formData.describe = this.describeList[0]
|
|
|
@@ -515,7 +542,7 @@ export default {
|
|
|
onSave(isSick) {
|
|
|
|
|
|
|
|
|
- if (this.formData.cowID!=this.editCowInfo['牛号']) {
|
|
|
+ if (this.formData.cowID != this.editCowInfo['牛号'] && !this.isBatch) {
|
|
|
this.$message({
|
|
|
message: '请录入牛只牛号',
|
|
|
type: 'warning'
|
|
|
@@ -523,6 +550,14 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ if (this.isBatch && this.cowList.length <= 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '请录入批量牛只牛号',
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if (isSick && this.formData.symptom.length == 0) {
|
|
|
this.$message({
|
|
|
message: '请选择发病症状',
|
|
|
@@ -538,6 +573,11 @@ export default {
|
|
|
});
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+ if (this.isBatch) {
|
|
|
+ this.saveBatch(0, isSick)
|
|
|
+ return
|
|
|
+ }
|
|
|
var formData = { ...this.formData }
|
|
|
formData.symptom = formData.symptom.join(';')
|
|
|
formData.area_FL = formData.breastArea_FL
|
|
|
@@ -564,7 +604,64 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
- this.saveDrug(0)
|
|
|
+ if (isSick) {
|
|
|
+ this.saveDrug(0)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.$message({
|
|
|
+ message: '保存成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.getList()
|
|
|
+ this.drugList = []
|
|
|
+ this.formData.cowID = ''
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveBatch(index, isSick) {
|
|
|
+ if (index >= this.cowList.length) {
|
|
|
+ this.$message({
|
|
|
+ message: '保存成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.drugList = []
|
|
|
+ this.cowList = []
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var formData = { ...this.formData }
|
|
|
+ formData.cowID = this.cowList[index]['牛号']
|
|
|
+ formData.currGroup = this.cowList[index]['当前牛舍']
|
|
|
+ formData.groCode = this.cowList[index]['当前状态']
|
|
|
+ formData.repCode = this.cowList[index]['繁殖状态']
|
|
|
+ formData.currLact = this.cowList[index]['当前胎次']
|
|
|
+ formData.symptom = formData.symptom.join(';')
|
|
|
+ formData.area_FL = formData.breastArea_FL
|
|
|
+ formData.area_FR = formData.breastArea_FR
|
|
|
+ formData.area_BL = formData.breastArea_BL
|
|
|
+ formData.area_BR = formData.breastArea_BR
|
|
|
+ formData.diseaseDate = Date.parse(new Date(formData.diseaseDate)) + 28800000
|
|
|
+ this.getHaleInfo('wsVeterinary', 'diseaseDiagnose', [
|
|
|
+ formData, formData.category, formData.name, isSick
|
|
|
+ ], 'json').then((data) => {
|
|
|
+ if (data.rtnCode == -1) {
|
|
|
+
|
|
|
+ this.$alert(data.rtnMessage, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ callback: action => {
|
|
|
+ this.formData.cowID = ''
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if (isSick) {
|
|
|
+ this.saveDrug(0, index)
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.saveBatch(index + 1, isSick)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
@@ -578,27 +675,44 @@ export default {
|
|
|
}
|
|
|
return guid;
|
|
|
},
|
|
|
- saveDrug(index) {
|
|
|
+ saveDrug(index, cowIndex) {
|
|
|
if (index >= this.drugList.length) {
|
|
|
- this.$message({
|
|
|
- message: '保存成功',
|
|
|
- type: 'success'
|
|
|
- });
|
|
|
- this.getList()
|
|
|
- this.drugList = []
|
|
|
- this.formData.cowID = ''
|
|
|
+ if (this.isBatch) {
|
|
|
+ if (cowIndex >= this.cowList.length - 1) {
|
|
|
+ this.$message({
|
|
|
+ message: '保存成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.drugList = []
|
|
|
+ this.cowList = []
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.saveBatch(cowIndex + 1, true)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.$message({
|
|
|
+ message: '保存成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.getList()
|
|
|
+ this.drugList = []
|
|
|
+ this.formData.cowID = ''
|
|
|
+
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- var prescriptionNO = this.getTime('', 'YYMMDD') + this.newGuid().replace(/-/g, '').toUpperCase().substr(0, 10)
|
|
|
+ var prescriptionNO = this.getTime(Date.parse(new Date()), 'YYMMDD') + this.newGuid().replace(/-/g, '').toUpperCase().substr(0, 10)
|
|
|
|
|
|
this.getHaleInfo('wsVeterinary', 'addPrescription', [
|
|
|
{
|
|
|
"prescriptionNO": prescriptionNO,
|
|
|
- "cowID": this.formData.cowID,
|
|
|
+ "cowID": this.isBatch?this.cowList[cowIndex]['牛号']:this.formData.cowID,
|
|
|
"prescriptionDate": Date.parse(new Date()),
|
|
|
"currFarm": this.$store.state.farmName,
|
|
|
- "currGroup": this.editCowInfo['当前牛舍'],
|
|
|
+ "currGroup": this.isBatch?this.cowList[cowIndex]['当前牛舍']:this.editCowInfo['当前牛舍'],
|
|
|
"bodyTemp": this.formData.bodyTemp,
|
|
|
"heartRate": this.formData.heartRate,
|
|
|
"breathing": this.formData.breathing,
|
|
|
@@ -618,7 +732,7 @@ export default {
|
|
|
"operators": this.$store.state.userInfo.username,
|
|
|
"operatTime": Date.parse(new Date()),
|
|
|
|
|
|
- }, this.editCowInfo['牛号'], this.formData.category, this.formData, name, prescriptionNO
|
|
|
+ }, this.isBatch?this.cowList[cowIndex]['牛号']:this.editCowInfo['牛号'], this.formData.category, this.formData.name, prescriptionNO
|
|
|
], 'json').then((data) => {
|
|
|
console.log(data)
|
|
|
if (data.rtnCode == -1) {
|
|
|
@@ -631,19 +745,22 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
- this.saveDrug(index + 1)
|
|
|
+ this.saveDrug(index + 1,cowIndex)
|
|
|
}
|
|
|
})
|
|
|
|
|
|
},
|
|
|
+ delCow(index) {
|
|
|
+ this.cowList.splice(index, 1)
|
|
|
+ },
|
|
|
getNowCow() {
|
|
|
|
|
|
this.getHaleInfo('wsCow', 'getCowExtendInfoByCowID', [
|
|
|
- this.formData.cowID, 3
|
|
|
+ this.cowID, 99
|
|
|
], 'json').then((data) => {
|
|
|
- this.editCowInfo = data
|
|
|
// console.log(data)
|
|
|
var list = []
|
|
|
+
|
|
|
Object.keys(data).forEach(item => {
|
|
|
list.push({
|
|
|
key: item,
|
|
|
@@ -651,38 +768,49 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
+ if (this.chooseList.indexOf(data['牛号']) == -1) {
|
|
|
+ this.cowList.push(data)
|
|
|
+ }
|
|
|
+ this.formData = {
|
|
|
+ "cowID": '',
|
|
|
+ "diseaseDate": this.getTime(Date.parse(new Date()), 'YYYY-MM-DD HH:mm:ss'),
|
|
|
+ "currFarm": this.$store.state.farmName,
|
|
|
+ "category": '乳房疾病',
|
|
|
+ "name": '乳房炎',
|
|
|
+ "symptom": [],
|
|
|
+ "bodyTemp": 2,
|
|
|
+ "isChangeGroup": false,
|
|
|
+ "heartRate": 1,
|
|
|
+ "breathing": 1,
|
|
|
+ "rumen": 1,
|
|
|
+ "visibleMocus": '正常',
|
|
|
+ "mentalState": '正常',
|
|
|
+ "defecationCase": '正常',
|
|
|
+ "area_FL": 0,
|
|
|
+ "area_FR": 0,
|
|
|
+ "area_BL": 0,
|
|
|
+ "area_BR": 0,
|
|
|
+ "breastArea_FL": 0,
|
|
|
+ "breastArea_FR": 0,
|
|
|
+ "breastArea_BL": 0,
|
|
|
+ "breastArea_BR": 0,
|
|
|
+ "veterinary": this.$store.state.userInfo.username,
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// console.log(list)
|
|
|
|
|
|
- this.tableData = list
|
|
|
+ this.cowID = ''
|
|
|
|
|
|
- if (data['繁殖状态'] != '复检有胎' && data['繁殖状态'] != '初检已孕') {
|
|
|
- this.$alert('当前母牛无胎,不允许进行登记', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
- this.formData.cowID = ''
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- else if (data['牛只类别'] == '成母牛' && parseInt(data['在胎天数']) < 150) {
|
|
|
- this.$alert('当前奶牛是成母牛,且在胎天数小于150天,不允许登记产犊(青年牛210天内允许报早产)!', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- callback: action => {
|
|
|
- this.formData.cowID = ''
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ this.tableData = list
|
|
|
|
|
|
- if (parseInt(data['在胎天数']) > 262) {
|
|
|
- this.formData.type == '正产'
|
|
|
- }
|
|
|
- else {
|
|
|
- this.formData.type == '早产'
|
|
|
- }
|
|
|
}).catch(() => {
|
|
|
this.formData.cowID = ''
|
|
|
})
|
|
|
},
|
|
|
rowClick(row) {
|
|
|
+ this.isBatch=false
|
|
|
this.editCowInfo = row
|
|
|
this.formData = {
|
|
|
"cowID": row['牛号'],
|
|
|
@@ -733,23 +861,23 @@ export default {
|
|
|
this.innerinnerVisible = true
|
|
|
}
|
|
|
},
|
|
|
- querySearchAsync(queryString, cb) {
|
|
|
- var restaurants = this.allCowList;
|
|
|
- var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
|
|
|
-
|
|
|
-
|
|
|
- var timeout = setTimeout(() => {
|
|
|
- cb(results);
|
|
|
- }, 3000 * Math.random());
|
|
|
- },
|
|
|
- createStateFilter(queryString) {
|
|
|
- return (state) => {
|
|
|
- return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
|
|
|
- };
|
|
|
- },
|
|
|
- chooseCow(val){
|
|
|
- this.rowClick(val)
|
|
|
- }
|
|
|
+ querySearchAsync(queryString, cb) {
|
|
|
+ var restaurants = this.allCowList;
|
|
|
+ var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;
|
|
|
+
|
|
|
+
|
|
|
+ var timeout = setTimeout(() => {
|
|
|
+ cb(results);
|
|
|
+ }, 3000 * Math.random());
|
|
|
+ },
|
|
|
+ createStateFilter(queryString) {
|
|
|
+ return (state) => {
|
|
|
+ return (state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
|
|
|
+ };
|
|
|
+ },
|
|
|
+ chooseCow(val) {
|
|
|
+ this.rowClick(val)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -829,4 +957,25 @@ export default {
|
|
|
cursor: pointer;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+.chooseItem {
|
|
|
+ width: 120px;
|
|
|
+ height: 30px;
|
|
|
+ background: rgba(236, 245, 255, 1);
|
|
|
+ border-radius: 2px;
|
|
|
+ border: 1px solid rgba(0, 150, 224, 1);
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: bold;
|
|
|
+ color: rgba(0, 150, 224, 1);
|
|
|
+ line-height: 30px;
|
|
|
+ letter-spacing: 1px;
|
|
|
+ padding: 0 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ margin-right: 10px;
|
|
|
+ i {
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|