This commit is contained in:
weipengfei 2024-01-29 18:12:35 +08:00
parent 4f948d61f3
commit 6997b3aa62
25 changed files with 531 additions and 409 deletions

View File

@ -15,3 +15,6 @@ export const fenceHouseTypeLists = () => syhttp.get('/common/dict_data_lists_by_
//动物类型 //动物类型
export const animalTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'animal_type'}); export const animalTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'animal_type'});
//饲料类型
export const feedingTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'feeding_type'});

View File

@ -11,3 +11,26 @@ export const fenceHouseList = (data) => syhttp.get('/fence_house/list', data);
//栏舍详情 //栏舍详情
export const fenceHouseDetail = (data) => syhttp.get('/fence_house/detail', data); export const fenceHouseDetail = (data) => syhttp.get('/fence_house/detail', data);
//新增养殖
export const animalInfoAdd = (data) => syhttp.post('/animal_info/add', data);
//新增驱虫
export const dewormingLogAdd = (data) => syhttp.post('/suyuan_operation.operation_deworming_log/add', data);
//新增消毒
export const disinfectLogAdd = (data) => syhttp.post('/suyuan_operation.operation_disinfect_log/add', data);
//新增喂食
export const feedingLogAdd = (data) => syhttp.post('/suyuan_operation.operation_feeding_log/add', data);
//新增喂水
export const waterLogAdd = (data) => syhttp.post('/suyuan_operation.operation_water_log/add', data);
//新增打疫苗
export const vaccinumLogAdd = (data) => syhttp.post('/suyuan_operation.operation_vaccinum_log/add', data);
//养殖列表
export const animalInfoList = (data) => syhttp.get('/animal_info/lists', data);
//喂养信息列表
export const operationLogIndex = (data) => syhttp.get('/operation_log/index', data);

View File

@ -8,8 +8,8 @@ let env = "dev"
let HTTP_REQUEST_URL let HTTP_REQUEST_URL
let HEADER let HEADER
if (env == 'dev') { if (env == 'dev') {
// BASE_URL = 'http://ceshi-suyuan.lihaink.cn/' BASE_URL = 'https://ceshi-suyuan-breed.lihaink.cn/'
BASE_URL = 'http://192.168.1.19:8084/' // BASE_URL = 'http://192.168.1.25:8084/'
} else if (env = 'prod') { } else if (env = 'prod') {
BASE_URL = 'http://ceshi-suyuan.lihaink.cn/' BASE_URL = 'http://ceshi-suyuan.lihaink.cn/'
} }

View File

@ -5,21 +5,21 @@
<view class="c-title">驱虫信息</view> <view class="c-title">驱虫信息</view>
<view class="c-box"> <view class="c-box">
<u-form-item label="驱虫药名称" prop="user" borderBottom required> <u-form-item label="驱虫药名称" prop="vermifuge_name" borderBottom required>
<up-input input-align="right" placeholder="请输入驱虫药名称" :disabled="mode=='detail'" type="txt" border="none" <up-input input-align="right" placeholder="请输入驱虫药名称" :disabled="mode=='detail'" border="none"
v-model="formData.user"></up-input> v-model="formData.vermifuge_name"></up-input>
</u-form-item> </u-form-item>
<up-form-item label="驱虫方式" prop="master_name" borderBottom required @click="showFun=true"> <up-form-item label="驱虫方式" prop="deworming_method" borderBottom required @click="showFun=true">
<up-input input-align="right" placeholder="请输入驱虫方式" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请输入驱虫方式" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="formData.fun" readonly></up-input> suffix-icon-style="color: #b6b6b6;" v-model="formData.deworming_method" readonly></up-input>
</up-form-item> </up-form-item>
<u-form-item label="驱虫人员" prop="start_date" @click="openDate" borderBottom required> <u-form-item label="驱虫人员" prop="operator" borderBottom required>
<up-input input-align="right" placeholder="请输入驱虫人员姓名" :disabled="mode=='detail'" type="number" border="none" <up-input input-align="right" placeholder="请输入驱虫人员姓名" :disabled="mode=='detail'" border="none"
v-model="formData.breed"></up-input> v-model="formData.operator"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="驱虫时间" prop="start_date" @click="openDate" borderBottom required> <u-form-item label="驱虫时间" prop="deworming_date" @click="openDate" borderBottom required>
<up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date" suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.deworming_date"
style="pointer-events: none;"></up-input> style="pointer-events: none;"></up-input>
</u-form-item> </u-form-item>
</view> </view>
@ -89,21 +89,29 @@
import { import {
addaction addaction
} from '@/api/api.js' } from '@/api/api.js'
import {
dewormingLogAdd
} from "@/api/manage.js"
const form = ref(null) const form = ref(null)
const task_id = ref(''); const task_id = ref('');
const pic = reactive([]); const pic = reactive([]);
const show1 = ref(false) const show1 = ref(false)
const formData = reactive({ const formData = reactive({
user: "", vermifuge_name: "",
deworming_method: "",
deworming_date: '',
operator: '',
remark: "", remark: "",
pic: [], pic: [],
start_date: '', fence_house_id: '',
fun: '' animal_info_id: '',
}) })
const dateConfirmfn = (e) => { const dateConfirmfn = (e) => {
formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') formData.deworming_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ')
show1.value = false show1.value = false
} }
const formatter = (type, value) => { const formatter = (type, value) => {
if (type === 'year') { if (type === 'year') {
return `${value}`; return `${value}`;
@ -117,7 +125,25 @@
return value; return value;
}; };
const rules = { const rules = {
'user': { 'vermifuge_name': {
type: 'string',
required: true,
message: '请填写参与人',
trigger: ['blur', 'change']
},
'deworming_method': {
type: 'string',
required: true,
message: '请选择驱虫方式',
trigger: ['blur', 'change']
},
'operator': {
type: 'string',
required: true,
message: '请选择驱虫人员',
trigger: ['blur', 'change']
},
'vermifuge_name': {
type: 'string', type: 'string',
required: true, required: true,
message: '请填写参与人', message: '请填写参与人',
@ -133,7 +159,7 @@
const showFun = ref(false); const showFun = ref(false);
const selectFun = (e)=>{ const selectFun = (e)=>{
formData.fun = e.name; formData.deworming_method = e.name;
} }
onReady(() => { onReady(() => {
@ -161,26 +187,19 @@
} }
const addFn = () => { const addFn = () => {
form.value.validate().then(res => { form.value.validate().then(res => {
console.log(res)
if (res) { if (res) {
formData.pic = pic
let data1 = { if (pic.length == 0) {
plant_id: task_id.value,
type: 5,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片') uni.$u.toast('请上传图片')
return return
} }
console.log('表单通过'); formData.pic = JSON.stringify(pic)
// //
addaction(data1).then((res) => { dewormingLogAdd(formData).then((res) => {
console.log(res)
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast(res.msg) uni.$u.toast(res.msg)
uni.navigateBack({ uni.navigateBack({
@ -242,24 +261,8 @@
} }
const mode = ref('add') const mode = ref('add')
onLoad((options) => { onLoad((options) => {
if (options.task) { formData.fence_house_id = options.house_id;
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; formData.animal_info_id = options.id;
// console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, ...data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '收获详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
}) })
</script> </script>

View File

@ -6,27 +6,28 @@
<view class="c-title">喂食信息</view> <view class="c-title">喂食信息</view>
<view class="c-box"> <view class="c-box">
<u-form-item label="饲料种类" prop="user" borderBottom required> <u-form-item label="饲料种类" prop="feed_type" borderBottom required @click="isshow">
<up-input input-align="right" placeholder="请输入饲料种类" :disabled="mode=='detail'" type="txt" <up-input input-align="right" placeholder="请输入饲料种类" :disabled="mode=='detail'" suffixIcon="arrow-down"
border="none" v-model="formData.user"></up-input> suffix-icon-style="color: #b6b6b6;"
border="none" v-model="feed_type" readonly></up-input>
</u-form-item> </u-form-item>
<u-form-item label="饲料品牌" prop="formData.breed" borderBottom required> <u-form-item label="饲料品牌" prop="formData.feed_brand" borderBottom required>
<up-input input-align="right" placeholder="请输入饲料品牌" :disabled="mode=='detail'" type="number" <up-input input-align="right" placeholder="请输入饲料品牌" :disabled="mode=='detail'"
border="none" v-model="formData.breed"></up-input> border="none" v-model="formData.feed_brand"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="饲料消耗量(kg)" prop="start_date" @click="openDate" borderBottom required> <u-form-item label="饲料消耗量(kg)" prop="feed_consumption" borderBottom required>
<up-input input-align="right" placeholder="请输入饲料消耗量" :disabled="mode=='detail'" type="number" <up-input input-align="right" placeholder="请输入饲料消耗量" :disabled="mode=='detail'" type="number"
border="none" v-model="formData.breed"></up-input> border="none" v-model="formData.feed_consumption"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="喂养人员" prop="start_date" @click="openDate" borderBottom required> <u-form-item label="喂养人员" prop="operator" borderBottom required>
<up-input input-align="right" placeholder="请输入喂养人员" :disabled="mode=='detail'" type="number" <up-input input-align="right" placeholder="请输入喂养人员" :disabled="mode=='detail'"
border="none" v-model="formData.breed"></up-input> border="none" v-model="formData.operator"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="喂食时间" prop="start_date" @click="openDate" borderBottom required> <!-- <u-form-item label="喂食时间" prop="start_date" @click="openDate" borderBottom required>
<up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date" suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date"
style="pointer-events: none;"></up-input> style="pointer-events: none;"></up-input>
</u-form-item> </u-form-item> -->
</view> </view>
<view class="card-li"> <view class="card-li">
@ -73,6 +74,9 @@
</u--form> </u--form>
<u-button class="btn" v-if="mode=='add'" @click="addFn">完成添加</u-button> <u-button class="btn" v-if="mode=='add'" @click="addFn">完成添加</u-button>
</view> </view>
<u-action-sheet :show="show" keyName="name" :actions="animal_type_lists" title="请选择" @close="show = false"
@select="leavaType1">
</u-action-sheet>
<u-datetime-picker :show="show1" :max-date="getNowTime()" v-model="value1" mode="datetime" <u-datetime-picker :show="show1" :max-date="getNowTime()" v-model="value1" mode="datetime"
@confirm="dateConfirmfn" :formatter="formatter" @cancel="show1=false"></u-datetime-picker> @confirm="dateConfirmfn" :formatter="formatter" @cancel="show1=false"></u-datetime-picker>
</view> </view>
@ -94,16 +98,26 @@
import { import {
addaction addaction
} from '@/api/api.js' } from '@/api/api.js'
import {
feedingTypeLists
} from "@/api/dict.js"
import {
feedingLogAdd
} from "@/api/manage.js"
const form = ref(null) const form = ref(null)
const task_id = ref(''); const task_id = ref('');
const pic = reactive([]); const pic = reactive([]);
const show1 = ref(false) const show1 = ref(false)
const formData = reactive({ const formData = reactive({
user: "", feed_type: "",
feed_brand: "",
feed_consumption: "",
operator: '',
remark: "", remark: "",
pic: [], pic: [],
start_date: '' fence_house_id: '',
animal_info_id: '',
}) })
const dateConfirmfn = (e) => { const dateConfirmfn = (e) => {
formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ')
@ -122,10 +136,10 @@
return value; return value;
}; };
const rules = { const rules = {
'user': { 'feed_type': {
type: 'string', type: 'string',
required: true, required: true,
message: '请填写参与人', message: '请选择饲料种类',
trigger: ['blur', 'change'] trigger: ['blur', 'change']
}, },
// 'remark': { // 'remark': {
@ -159,32 +173,40 @@
return timestamp return timestamp
} }
const show = ref(false)
const isshow = () => {
show.value = true
}
const animal_type_lists = ref([]);
const initAnimalTypeLists = ()=>{
feedingTypeLists().then(res=>{
animal_type_lists.value = res.data;
})
}
initAnimalTypeLists();
const feed_type = ref('');
const leavaType1 = (e) => {
feed_type.value = e.name;
formData.feed_type = e.value;
}
const addFn = () => { const addFn = () => {
form.value.validate().then(res => { form.value.validate().then(res => {
console.log(res) console.log(res)
if (res) { if (res) {
if (pic.length == 0) {
uni.$u.toast('请上传图片')
formData.pic = pic return
let data1 = {
plant_id: task_id.value,
type: 5,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
} }
console.log('表单通过'); formData.pic = JSON.stringify(pic)
// //
addaction(data1).then((res) => { feedingLogAdd(formData).then((res) => {
console.log(res)
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast(res.msg) uni.$u.toast(res.msg)
uni.navigateBack({ uni.navigateBack({
@ -250,24 +272,8 @@
} }
const mode = ref('add') const mode = ref('add')
onLoad((options) => { onLoad((options) => {
if (options.task) { formData.fence_house_id = options.house_id;
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; formData.animal_info_id = options.id;
// console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, ...data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '收获详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
}) })
</script> </script>

View File

@ -5,31 +5,31 @@
<view class="c-title">消毒信息</view> <view class="c-title">消毒信息</view>
<view class="c-box"> <view class="c-box">
<u-form-item label="消毒剂名称" prop="user" borderBottom required> <u-form-item label="消毒剂名称" prop="disinfectant_name" borderBottom required>
<up-input input-align="right" placeholder="请输入消毒剂名称" :disabled="mode=='detail'" type="txt" border="none" <up-input input-align="right" placeholder="请输入消毒剂名称" :disabled="mode=='detail'" type="txt" border="none"
v-model="formData.user"></up-input> v-model="formData.disinfectant_name"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="消毒剂浓度" prop="formData.breed" borderBottom required> <u-form-item label="消毒剂浓度" prop="concentration" borderBottom required>
<up-input input-align="right" placeholder="请输入消毒剂浓度" :disabled="mode=='detail'" type="number" border="none" <up-input input-align="right" placeholder="请输入消毒剂浓度" :disabled="mode=='detail'" type="number" border="none"
v-model="formData.breed"></up-input> v-model="formData.concentration"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="消毒方法" prop="start_date" @click="openDate" borderBottom required> <u-form-item label="消毒方法" prop="disinfectant_method" borderBottom required>
<up-input input-align="right" placeholder="请输入消毒方法" :disabled="mode=='detail'" type="number" border="none" <up-input input-align="right" placeholder="请输入消毒方法" :disabled="mode=='detail'" type="number" border="none"
v-model="formData.breed"></up-input> v-model="formData.disinfectant_method"></up-input>
</u-form-item> </u-form-item>
<up-form-item label="消毒区域" prop="master_name" borderBottom required @click="showFun=true"> <up-form-item label="消毒区域" prop="disinfectant_area" borderBottom required @click="showFun=true">
<up-input input-align="right" placeholder="请选择区域" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择区域" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="formData.fun" readonly></up-input> suffix-icon-style="color: #b6b6b6;" v-model="formData.disinfectant_area" readonly></up-input>
</up-form-item> </up-form-item>
<u-form-item label="消毒人员" prop="start_date" @click="openDate" borderBottom required> <u-form-item label="消毒人员" prop="operator" borderBottom required>
<up-input input-align="right" placeholder="请输入消毒人员姓名" :disabled="mode=='detail'" type="number" border="none" <up-input input-align="right" placeholder="请输入消毒人员姓名" :disabled="mode=='detail'" type="number" border="none"
v-model="formData.breed"></up-input> v-model="formData.operator"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="消毒时间" prop="start_date" @click="openDate" borderBottom required> <!-- <u-form-item label="消毒时间" prop="disinfectant_date" @click="openDate" borderBottom required>
<up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date" suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.disinfectant_date"
style="pointer-events: none;"></up-input> style="pointer-events: none;"></up-input>
</u-form-item> </u-form-item> -->
</view> </view>
<view class="card-li"> <view class="card-li">
@ -102,14 +102,19 @@
const pic = reactive([]); const pic = reactive([]);
const show1 = ref(false) const show1 = ref(false)
const formData = reactive({ const formData = reactive({
user: "", disinfectant_name: "",
concentration: "",
disinfectant_method: "",
disinfectant_area: "",
disinfectant_date: '',
operator: '',
remark: "", remark: "",
pic: [], pic: [],
start_date: '', fence_house_id: '',
fun: '' animal_info_id: '',
}) })
const dateConfirmfn = (e) => { const dateConfirmfn = (e) => {
formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') formData.disinfectant_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ')
show1.value = false show1.value = false
} }
const formatter = (type, value) => { const formatter = (type, value) => {
@ -141,7 +146,7 @@
const showFun = ref(false); const showFun = ref(false);
const selectFun = (e)=>{ const selectFun = (e)=>{
formData.fun = e.name; formData.deworming_method = e.name;
} }
onReady(() => { onReady(() => {
@ -250,24 +255,8 @@
} }
const mode = ref('add') const mode = ref('add')
onLoad((options) => { onLoad((options) => {
if (options.task) { formData.fence_house_id = options.house_id;
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; formData.animal_info_id = options.id;
// console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, ...data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '收获详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
}) })
</script> </script>

View File

@ -5,39 +5,43 @@
<view class="c-title">疫苗信息</view> <view class="c-title">疫苗信息</view>
<view class="c-box"> <view class="c-box">
<up-form-item label="疫苗名称" prop="master_name" borderBottom required @click="showName=true"> <!-- <up-form-item label="疫苗名称" prop="master_name" borderBottom required @click="showName=true">
<up-input input-align="right" placeholder="请选择疫苗" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择疫苗" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="formData.name" readonly></up-input> suffix-icon-style="color: #b6b6b6;" v-model="formData.name" readonly></up-input>
</up-form-item> </up-form-item> -->
<u-form-item label="疫苗厂家" prop="formData.breed" borderBottom required> <u-form-item label="疫苗名称" prop="formData.vaccine_name" borderBottom required>
<up-input input-align="right" placeholder="请输入疫苗名称" :disabled="mode=='detail'" border="none"
v-model="formData.vaccine_name"></up-input>
</u-form-item>
<u-form-item label="疫苗厂家" prop="formData.vaccine_manufacturers" borderBottom required>
<up-input input-align="right" placeholder="请输入疫苗厂家" :disabled="mode=='detail'" border="none" <up-input input-align="right" placeholder="请输入疫苗厂家" :disabled="mode=='detail'" border="none"
v-model="formData.breed"></up-input> v-model="formData.vaccine_manufacturers"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="疫苗批次号" prop="start_date" borderBottom required> <u-form-item label="疫苗批次号" prop="vaccine_batch" borderBottom required>
<up-input input-align="right" placeholder="请输入批次号" :disabled="mode=='detail'" border="none" <up-input input-align="right" placeholder="请输入批次号" :disabled="mode=='detail'" border="none"
v-model="formData.breed"></up-input> v-model="formData.vaccine_batch"></up-input>
</u-form-item> </u-form-item>
<up-form-item label="疫苗接种方式" prop="master_name" borderBottom required @click="showFun=true"> <up-form-item label="疫苗接种方式" prop="vaccination_method" borderBottom required @click="showFun=true">
<up-input input-align="right" placeholder="请选择方式" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择方式" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="formData.fun" readonly></up-input> suffix-icon-style="color: #b6b6b6;" v-model="vaccination_method" readonly></up-input>
</up-form-item> </up-form-item>
<up-form-item label="疫苗接种部位" prop="master_name" borderBottom required @click="showPart=true"> <up-form-item label="疫苗接种部位" prop="vaccination_site" borderBottom required @click="showPart=true">
<up-input input-align="right" placeholder="请选择接种部位" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择接种部位" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="formData.part" readonly></up-input> suffix-icon-style="color: #b6b6b6;" v-model="vaccination_site" readonly></up-input>
</up-form-item> </up-form-item>
<u-form-item label="免疫有限期" prop="start_date" borderBottom required> <u-form-item label="免疫有限期" prop="immune_validity_period" borderBottom required>
<up-input input-align="right" placeholder="请输入免疫有限期" :disabled="mode=='detail'" border="none" <up-input input-align="right" placeholder="请输入免疫有限期" :disabled="mode=='detail'" border="none"
v-model="formData.breed"></up-input> v-model="formData.immune_validity_period"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="疫苗注射人员" prop="start_date" borderBottom required> <u-form-item label="疫苗注射人员" prop="operator" borderBottom required>
<up-input input-align="right" placeholder="请输入操作人员姓名" :disabled="mode=='detail'" border="none" <up-input input-align="right" placeholder="请输入操作人员姓名" :disabled="mode=='detail'" border="none"
v-model="formData.breed"></up-input> v-model="formData.operator"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="疫苗接种时间" prop="start_date" @click="openDate" borderBottom required> <!-- <u-form-item label="疫苗接种时间" prop="start_date" @click="openDate" borderBottom required>
<up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date" suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date"
style="pointer-events: none;"></up-input> style="pointer-events: none;"></up-input>
</u-form-item> </u-form-item> -->
</view> </view>
<view class="card-li"> <view class="card-li">
@ -109,16 +113,25 @@
import { import {
addaction addaction
} from '@/api/api.js' } from '@/api/api.js'
import {
vaccinumLogAdd
} from "@/api/manage.js"
const form = ref(null) const form = ref(null)
const task_id = ref(''); const task_id = ref('');
const pic = reactive([]); const pic = reactive([]);
const show1 = ref(false) const show1 = ref(false)
const formData = reactive({ const formData = reactive({
user: "", vaccine_name: "",
vaccine_manufacturers: "",
vaccine_batch: "",
vaccination_method: "",
vaccination_site: '',
immune_validity_period: "",
operator: '',
remark: "", remark: "",
pic: [], pic: [],
start_date: '', fence_house_id: '',
fun: '' animal_info_id: '',
}) })
const dateConfirmfn = (e) => { const dateConfirmfn = (e) => {
formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ')
@ -152,12 +165,18 @@
} }
const showFun = ref(false); const showFun = ref(false);
const vaccination_method = ref('');
const selectFun = (e)=>{ const selectFun = (e)=>{
formData.fun = e.name; vaccination_method.value = e.name;
if(e.name=='肌肉注射') formData.vaccination_method = '1';
if(e.name=='皮下注射') formData.vaccination_method = '2';
} }
const showPart = ref(false); const showPart = ref(false);
const vaccination_site = ref('');
const selectPart = (e)=>{ const selectPart = (e)=>{
formData.part = e.name; vaccination_site.value = e.name;
if(e.name=='颈部') formData.vaccination_site = '1';
if(e.name=='大腿') formData.vaccination_site = '2';
} }
const showName = ref(false); const showName = ref(false);
const selectName = (e)=>{ const selectName = (e)=>{
@ -191,23 +210,17 @@
form.value.validate().then(res => { form.value.validate().then(res => {
console.log(res) console.log(res)
if (res) { if (res) {
formData.pic = pic if (pic.length == 0) {
let data1 = {
plant_id: task_id.value,
type: 5,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片') uni.$u.toast('请上传图片')
return return
} }
console.log('表单通过'); formData.pic = JSON.stringify(pic)
// //
addaction(data1).then((res) => { vaccinumLogAdd(formData).then((res) => {
console.log(res) console.log(res)
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast(res.msg) uni.$u.toast(res.msg)
@ -270,24 +283,8 @@
} }
const mode = ref('add') const mode = ref('add')
onLoad((options) => { onLoad((options) => {
if (options.task) { formData.fence_house_id = options.house_id;
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; formData.animal_info_id = options.id;
// console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, ...data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '收获详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
}) })
</script> </script>

View File

@ -5,19 +5,19 @@
<view class="c-title">喂水信息</view> <view class="c-title">喂水信息</view>
<view class="c-box"> <view class="c-box">
<u-form-item label="喂水量(L)" prop="user" borderBottom required> <u-form-item label="喂水量(L)" prop="water_consumption" borderBottom required>
<up-input input-align="right" placeholder="请输入喂水量" :disabled="mode=='detail'" type="number" <up-input input-align="right" placeholder="请输入喂水量" :disabled="mode=='detail'" type="number"
border="none" v-model="formData.user"></up-input> border="none" v-model="formData.water_consumption"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="喂水人员" prop="start_date" borderBottom required> <u-form-item label="喂水人员" prop="operator" borderBottom required>
<up-input input-align="right" placeholder="请输入喂水人员" :disabled="mode=='detail'" <up-input input-align="right" placeholder="请输入喂水人员" :disabled="mode=='detail'"
border="none" v-model="formData.breed"></up-input> border="none" v-model="formData.operator"></up-input>
</u-form-item> </u-form-item>
<u-form-item label="喂水时间" prop="start_date" @click="openDate" borderBottom required> <!-- <u-form-item label="喂水时间" prop="start_date" @click="openDate" borderBottom required>
<up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择时间" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date" suffix-icon-style="color: #b6b6b6;" readonly border="none" v-model="formData.start_date"
style="pointer-events: none;"></up-input> style="pointer-events: none;"></up-input>
</u-form-item> </u-form-item> -->
</view> </view>
<view class="card-li"> <view class="card-li">
@ -85,16 +85,21 @@
import { import {
addaction addaction
} from '@/api/api.js' } from '@/api/api.js'
import {
waterLogAdd
} from '@/api/manage.js'
const form = ref(null) const form = ref(null)
const task_id = ref(''); const task_id = ref('');
const pic = reactive([]); const pic = reactive([]);
const show1 = ref(false) const show1 = ref(false)
const formData = reactive({ const formData = reactive({
user: "", water_consumption: "",
operator: '',
remark: "", remark: "",
pic: [], pic: [],
start_date: '' fence_house_id: '',
animal_info_id: '',
}) })
const dateConfirmfn = (e) => { const dateConfirmfn = (e) => {
formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ')
@ -154,27 +159,16 @@
form.value.validate().then(res => { form.value.validate().then(res => {
console.log(res) console.log(res)
if (res) { if (res) {
if (pic.length == 0) {
uni.$u.toast('请上传图片')
return
formData.pic = pic }
let data1 = {
plant_id: task_id.value, formData.pic = JSON.stringify(pic)
type: 5,
detail: JSON.stringify(formData)
};
if (formData.pic.length == 0) {
uni.$u.toast('请上传图片')
return
}
console.log('表单通过');
// //
addaction(data1).then((res) => { waterLogAdd(formData).then((res) => {
console.log(res) console.log(res)
if (res.code == 1) { if (res.code == 1) {
uni.$u.toast(res.msg) uni.$u.toast(res.msg)
@ -241,24 +235,8 @@
} }
const mode = ref('add') const mode = ref('add')
onLoad((options) => { onLoad((options) => {
if (options.task) { formData.fence_house_id = options.house_id;
let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; formData.animal_info_id = options.id;
// console.log(data, data.detail)
Object.assign(formData, data.detail);
pic.splice(0, pic.length, ...data.detail.pic);
mode.value = 'detail'
uni.setNavigationBarTitle({
title: '收获详情'
})
// formData=data.detail
} else {
task_id.value = options.id
}
}) })
</script> </script>

View File

@ -99,15 +99,96 @@
智能监测数据 智能监测数据
</view> </view>
<view class="area-check"> <view class="area-check">
<view class="area-li" v-for="(item,index) in soilList" key="index" <view class="area-li" key="index"
:style="{backgroundImage:`url(${bgc(item.icon)})`}"> :style="{backgroundImage:`url(${bgc('huan_jing_wen_du')})`}">
<view class=""> <view class="">
{{item.name}} 空气温度
</view> </view>
<view class="" style="color:#ffb351"> <view class="standard" :class="{'red': monitorData.ambient_temperature > monitorThreshold.air_temp_max || monitorData.ambient_temperature < monitorThreshold.air_temp_min}">
{{ item.num?item.num+item.unit:'--' }} {{ monitorData.ambient_temperature || monitorData.ambient_temperature === 0 ? monitorData.ambient_temperature + '℃':'--' }}
</view> </view>
</view> <view v-if="monitorData.ambient_temperature > monitorThreshold.air_temp_max" class="a-tips red">
{{ compDatas(monitorData.ambient_temperature, monitorThreshold.air_temp_max) }}{{'℃'}}
</view>
<view v-if="monitorData.ambient_temperature < monitorThreshold.air_temp_min" class="a-tips blue">
{{ compDatas(monitorThreshold.air_temp_min, monitorData.ambient_temperature) }}{{'℃'}}
</view>
</view>
<view class="area-li" key="index"
:style="{backgroundImage:`url(${bgc('huan_jing_shi_du')})`}">
<view class="">
空气湿度
</view>
<view class="standard" :class="{'red': monitorData.ambient_humidity > monitorThreshold.air_mois_max || monitorData.ambient_humidity < monitorThreshold.air_mois_min}">
{{ monitorData.ambient_humidity || monitorData.ambient_humidity === 0 ? monitorData.ambient_humidity + '%':'--' }}
</view>
<view v-if="monitorData.ambient_humidity > monitorThreshold.air_mois_max" class="a-tips red">
{{ compDatas(monitorData.ambient_humidity, monitorThreshold.air_mois_max) }}{{'%'}}
</view>
<view v-if="monitorData.ambient_humidity < monitorThreshold.air_mois_min" class="a-tips blue">
{{ compDatas(monitorThreshold.air_mois_min, monitorData.ambient_humidity) }}{{'%'}}
</view>
</view>
<view class="area-li" key="index"
:style="{backgroundImage:`url(${bgc('dan_qi')})`}">
<view class="">
氮气
</view>
<view class="standard" :class="{'red': monitorData.nitrogen > monitorThreshold.nitrogen_max || monitorData.nitrogen < monitorThreshold.nitrogen_min}">
{{ monitorData.nitrogen || monitorData.nitrogen === 0 ? monitorData.nitrogen + 'ppm':'--' }}
</view>
<view v-if="monitorData.nitrogen > monitorThreshold.nitrogen_max" class="a-tips red">
{{ compDatas(monitorData.nitrogen, monitorThreshold.nitrogen_max) }}{{'ppm'}}
</view>
<view v-if="monitorData.nitrogen < monitorThreshold.nitrogen_min" class="a-tips blue">
{{ compDatas(monitorThreshold.nitrogen_min, monitorData.nitrogen) }}{{'ppm'}}
</view>
</view>
<view class="area-li" key="index"
:style="{backgroundImage:`url(${bgc('jia_wan')})`}">
<view class="">
甲烷
</view>
<view class="standard" :class="{'red': monitorData.methane > monitorThreshold.methane_max || monitorData.methane < monitorThreshold.methane_min}">
{{ monitorData.methane || monitorData.methane === 0 ? monitorData.methane + 'ppm':'--' }}
</view>
<view v-if="monitorData.methane > monitorThreshold.methane_max" class="a-tips red">
{{ compDatas(monitorData.methane, monitorThreshold.methane_max) }}{{'ppm'}}
</view>
<view v-if="monitorData.methane < monitorThreshold.methane_min" class="a-tips blue">
{{ compDatas(monitorThreshold.methane_min, monitorData.methane) }}{{'ppm'}}
</view>
</view>
<view class="area-li" key="index"
:style="{backgroundImage:`url(${bgc('zao_yin')})`}">
<view class="">
噪音
</view>
<view class="standard" :class="{'red': monitorData.noise > monitorThreshold.noise_max || monitorData.noise < monitorThreshold.noise_min}">
{{ monitorData.noise || monitorData.noise === 0 ? monitorData.noise + 'db' : '--' }}
</view>
<view v-if="monitorData.noise > monitorThreshold.noise_max" class="a-tips red">
{{ compDatas(monitorData.noise, monitorThreshold.noise_max) }}{{'db'}}
</view>
<view v-if="monitorData.noise < monitorThreshold.noise_min" class="a-tips blue">
{{ compDatas(monitorThreshold.noise_min, monitorData.noise) }}{{'db'}}
</view>
</view>
<view class="area-li" key="index"
:style="{backgroundImage:`url(${bgc('fang_huo')})`}">
<view class="">
防火
</view>
<view class="standard" :class="{'red': monitorData.fireproof > monitorThreshold.fireproof_max || monitorData.fireproof < monitorThreshold.fireproof_min}">
{{ monitorData.fireproof || monitorData.fireproof === 0 ? monitorData.fireproof : '--' }}
</view>
<view v-if="monitorData.fireproof > monitorThreshold.fireproof_max" class="a-tips red">
{{ compDatas(monitorData.fireproof, monitorThreshold.fireproof_max) }}
</view>
<view v-if="monitorData.fireproof < monitorThreshold.fireproof_min" class="a-tips blue">
{{ compDatas(monitorThreshold.fireproof_min, monitorData.fireproof) }}
</view>
</view>
</view> </view>
</view> </view>
@ -154,8 +235,6 @@
<u-picker keyName="name" :show="showPicker1" @cancel="showPicker1=false" @confirm="confirm1" <u-picker keyName="name" :show="showPicker1" @cancel="showPicker1=false" @confirm="confirm1"
:columns="columns2"></u-picker> :columns="columns2"></u-picker>
<u-picker keyName="label" :show="showPicker" @cancel="showPicker=false" @confirm="confirm2"
:columns="columns1"></u-picker>
</view> </view>
</template> </template>
@ -185,61 +264,18 @@
const showModal = ref(false) const showModal = ref(false)
const columns1 = reactive([
[{
label: '施肥',
route: "/pages/husbandryForm/fertilize"
}, {
label: '除草',
route: "/pages/husbandryForm/weeding"
}, {
label: '灌溉',
route: "/pages/husbandryForm/irrigate"
}, {
label: '除虫',
route: "/pages/husbandryForm/Pest"
}, {
label: '收获',
route: "/pages/husbandryForm/harvest"
}]
]);
const columns2 = reactive([]) const columns2 = reactive([])
const range = reactive([]) const range = reactive([])
//
const url = ref('https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg') const compDatas = (a, b)=>{
const soilList = reactive([{ try{
icon: "huan_jing_wen_du", let c = a - b;
name: "空气温度", return c.toFixed(2)
num: 0, }catch(e){
unit: "℃", return '0.00'
}
}, { }
icon: "huan_jing_shi_du",
name: "空气湿度",
num: 0,
unit: "%",
}, {
icon: "dan_qi",
name: "氮气",
num: 0,
unit: "ppm",
}, {
icon: "jia_wan",
name: "甲烷",
num: 0,
unit: "ppm",
}, {
icon: "zao_yin",
name: "噪音",
num: 0,
unit: "db",
},
])
const userInfo = ref({}); const userInfo = ref({});
onLoad(() => { onLoad(() => {
@ -283,6 +319,7 @@
}) })
} }
const video_url = ref() const video_url = ref()
const videoCover = ref('')
const show = ref(false) const show = ref(false)
const showLoading = ref(false) const showLoading = ref(false)
@ -372,7 +409,7 @@
id: step.id, id: step.id,
}; };
})); }));
if(res.data.length>0) houseInfo.value = res.data[0]; if(res.data.length>0) houseInfo.value = res.data[1];
else houseInfo.value = {}; else houseInfo.value = {};
store.commit('setHouse', houseInfo.value); store.commit('setHouse', houseInfo.value);
getlist(); getlist();
@ -387,7 +424,9 @@
}) })
// //
const monitor = ref({}); const monitorData = ref({});
//
const monitorThreshold = ref({});
// //
const getlist = () => { const getlist = () => {
@ -395,7 +434,8 @@
fence_house_id: houseInfo.value.id fence_house_id: houseInfo.value.id
}).then(res=>{ }).then(res=>{
video_url.value = "http://60.204.152.17:8888/live/xumu_user1.live.mp4" video_url.value = "http://60.204.152.17:8888/live/xumu_user1.live.mp4"
console.log(res); monitorData.value = res.data.monitor?.datas||{};
monitorThreshold.value = res.data.monitor?.threshold||{};
}) })
} }
@ -675,7 +715,22 @@
border-radius: 10rpx; border-radius: 10rpx;
background-size: 100% 100%; background-size: 100% 100%;
margin-bottom: 20rpx; margin-bottom: 20rpx;
padding: 45rpx 30rpx; padding: 30rpx;
padding-top: 45rpx;
.standard{
color: #43d295;
}
.red{
color: #f65b5b;
}
.blue{
color: #52bbf3;
}
.a-tips{
font-size: 22rpx;
}
} }
} }
@ -796,4 +851,5 @@
padding-left: 200rpx; padding-left: 200rpx;
padding-right: 10rpx; padding-right: 10rpx;
} }
</style> </style>

View File

@ -5,63 +5,64 @@
<up-form labelWidth='130' :model="data.formData" ref="form1"> <up-form labelWidth='130' :model="data.formData" ref="form1">
<view class="c-title">养殖信息</view> <view class="c-title">养殖信息</view>
<view class="c-box"> <view class="c-box">
<up-form-item label="耳号" prop="title" borderBottom required> <up-form-item label="耳号" prop="sn" borderBottom required>
<up-input input-align="right" placeholder="请输入耳号" border="none" v-model="data.formData.title"></up-input> <up-input input-align="right" placeholder="请输入耳号" border="none" v-model="data.formData.sn"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="品类" prop="title" borderBottom required> <up-form-item label="品类" prop="animal_type" borderBottom required @click="isshow1">
<up-input input-align="right" placeholder="请输入品类名称" border="none" v-model="data.formData.title"></up-input> <up-input input-align="right" placeholder="请输入品类名称" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="animal_type" readonly></up-input>
</up-form-item> </up-form-item>
<up-form-item label="品种" prop="area" borderBottom required> <up-form-item label="品种" prop="brand" borderBottom required>
<up-input input-align="right" placeholder="请输入品种名称" border="none" v-model="data.formData.area"></up-input> <up-input input-align="right" placeholder="请输入品种名称" border="none" v-model="data.formData.brand"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="性别" prop="master_name" borderBottom required @click="showSex=true"> <up-form-item label="性别" prop="gender" borderBottom required @click="showSex=true">
<up-input input-align="right" placeholder="请选择性别" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择性别" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="data.formData.sex" readonly></up-input> suffix-icon-style="color: #b6b6b6;" v-model="gender" readonly></up-input>
</up-form-item> </up-form-item>
<up-form-item label="生理阶段" prop="master_phone" borderBottom required> <up-form-item label="生理阶段" prop="physi_stage" borderBottom required>
<up-input input-align="right" placeholder="请输入生理阶段" border="none" <up-input input-align="right" placeholder="请输入生理阶段" border="none"
v-model="data.formData.master_phone"></up-input> v-model="data.formData.physi_stage"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="血统纯度" prop="master_phone" borderBottom required> <up-form-item label="血统纯度" prop="blood_purity" borderBottom required>
<up-input input-align="right" placeholder="请输入血统纯度" border="none" <up-input input-align="right" placeholder="请输入血统纯度" border="none"
v-model="data.formData.master_phone"></up-input> v-model="data.formData.blood_purity"></up-input>
</up-form-item> </up-form-item>
<block v-if="data.formData.type==1"> <block v-if="data.formData.type==1">
<up-form-item label="来源" borderBottom> <up-form-item label="来源" borderBottom>
<up-input input-align="right" border="none" v-model="data.formData.type_name" readonly></up-input> <up-input input-align="right" border="none" v-model="animal_source" readonly></up-input>
</up-form-item> </up-form-item>
<up-form-item label="栏舍" prop="master_phone" borderBottom required> <up-form-item label="栏舍" prop="fence_house_name" borderBottom required>
<up-input input-align="right" placeholder="请输入栏舍" border="none" <up-input input-align="right" placeholder="请输入栏舍" border="none"
v-model="data.formData.fence_house_name"></up-input> v-model="data.formData.fence_house_name"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="现估重(kg)" prop="master_phone" borderBottom required> <up-form-item label="现估重(kg)" prop="current_estimation" borderBottom required>
<up-input input-align="right" placeholder="请输入现估重" type="number" border="none" <up-input input-align="right" placeholder="请输入现估重" type="number" border="none"
v-model="data.formData.master_phone"></up-input> v-model="data.formData.current_estimation"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="入场日期" prop="master_phone" borderBottom required @click="showDate=true"> <up-form-item label="入场日期" prop="entry_date" borderBottom required @click="showDate=true">
<up-input input-align="right" placeholder="请选择入场日期" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择入场日期" border="none" suffixIcon="arrow-down"
suffix-icon-style="color: #b6b6b6;" v-model="data.formData.join_date"></up-input> suffix-icon-style="color: #b6b6b6;" v-model="data.formData.entry_date"></up-input>
</up-form-item> </up-form-item>
</block> </block>
<block v-else> <block v-else>
<up-form-item label="来源" borderBottom> <up-form-item label="来源" borderBottom>
<up-input input-align="right" border="none" v-model="data.formData.type_name" readonly></up-input> <up-input input-align="right" border="none" v-model="animal_source" readonly></up-input>
</up-form-item> </up-form-item>
<up-form-item label="栏舍" prop="master_phone" borderBottom required> <up-form-item label="栏舍" prop="fence_house_name" borderBottom required>
<up-input input-align="right" placeholder="请输入栏舍" border="none" <up-input input-align="right" placeholder="请输入栏舍" border="none"
v-model="data.formData.master_phone"></up-input> v-model="data.formData.fence_house_name"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="代数" prop="" borderBottom required> <up-form-item label="代数" prop="algebra" borderBottom required>
<up-input input-align="right" placeholder="请输入代数" type="number" border="none" <up-input input-align="right" placeholder="请输入代数" type="number" border="none"
v-model="data.formData.master_phone"></up-input> v-model="data.formData.algebra"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="现估重(kg)" prop="master_phone" borderBottom required> <up-form-item label="现估重(kg)" prop="current_estimation" borderBottom required>
<up-input input-align="right" placeholder="请输入现估重" type="number" border="none" <up-input input-align="right" placeholder="请输入现估重" type="number" border="none"
v-model="data.formData.master_phone"></up-input> v-model="data.formData.current_estimation"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="出生体重(kg)" prop="master_phone" borderBottom required> <up-form-item label="出生体重(kg)" prop="birth_estimation" borderBottom required>
<up-input input-align="right" placeholder="请输入出生体重" type="number" border="none" <up-input input-align="right" placeholder="请输入出生体重" type="number" border="none"
v-model="data.formData.master_phone"></up-input> v-model="data.formData.birth_estimation"></up-input>
</up-form-item> </up-form-item>
<up-form-item label="出生日期" borderBottom required @click="showDate=true"> <up-form-item label="出生日期" borderBottom required @click="showDate=true">
<up-input input-align="right" placeholder="请选择出生日期" border="none" suffixIcon="arrow-down" <up-input input-align="right" placeholder="请选择出生日期" border="none" suffixIcon="arrow-down"
@ -101,10 +102,13 @@
</view> </view>
</view> </view>
</up-form> </up-form>
<u-action-sheet :show="showSex" keyName="name" closeOnClickOverlay :actions="[{name:'公'}, {name:'母'}]" title="请选择" <u-action-sheet :show="showSex" keyName="name" closeOnClickOverlay :actions="[{name:'公'}, {name:'母'}]" title="请选择"
@close="showSex = false" @select="selectSex"></u-action-sheet> @close="showSex = false" @select="selectSex"></u-action-sheet>
<u-datetime-picker :show="showDate" :max-date="Date.now()" mode="date" v-model="changeTime" <u-datetime-picker :show="showDate" :max-date="Date.now()" mode="date" v-model="changeTime"
@confirm="selectDate" :formatter="formatter" @cancel="showDate=false"></u-datetime-picker> @confirm="selectDate" :formatter="formatter" @cancel="showDate=false"></u-datetime-picker>
<u-action-sheet :show="show1" keyName="name" :actions="animal_type_lists" title="请选择" @close="show1 = false"
@select="leavaType1">
</u-action-sheet>
<u-button class="btn" @click="submit">提交</u-button> <u-button class="btn" @click="submit">提交</u-button>
</view> </view>
</view> </view>
@ -126,17 +130,32 @@
import { import {
Uploads Uploads
} from "@/api/upload.js" } from "@/api/upload.js"
import {
animalTypeLists,
fenceHouseTypeLists
} from "@/api/dict.js"
import {
animalInfoAdd
} from "@/api/manage.js"
const form1 = ref(null); const form1 = ref(null);
const data = reactive({ const data = reactive({
formData: { formData: {
fence_house_id: '', //id fence_house_id: '', //id
title: '', sn: '',
sex: '', animal_type: '',
type: 1, brand: '',
brith_date: '', // physi_stage: '',
join_date: '', // gender: '',
type_name: '购买', // blood_purity: '',
current_estimation: '',
algebra: '',
birth: '',
entry_date: '',
birth_estimation: '',
health_condition: '',
type: 1, // 1-
animal_source: '2', // 1: 2:
master_name: '', master_name: '',
master_phone: '', master_phone: '',
pic: ['https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80', pic: ['https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80',
@ -144,46 +163,47 @@
] ]
}, },
rules: { rules: {
title: [{ fence_house_id: [{
type: 'string', type: 'string',
required: true, required: true,
message: '请填写养殖基地名称', message: '请选择栏舍',
trigger: ['blur', 'change'] trigger: ['blur', 'change']
}], }],
area: [{ sn: [{
type: 'string', type: 'string',
required: true, required: true,
message: '请填写养殖基地面积', message: '请输入耳号',
trigger: ['blur', 'change'] trigger: ['blur', 'change']
}], }],
master_name: [{ animal_type: [{
type: 'string', type: 'string',
required: true, required: true,
message: '请输入养殖基地负责人名称', message: '请选择品类',
trigger: ['blur', 'change'] trigger: ['blur', 'change']
}], }],
master_phone: [{
required: true,
message: '请输入手机号',
trigger: ['change', 'blur'],
},
{
validator: (rule, value, callback) => {
// truefalse
// uni.$u.test.mobile()truefalse
return uni.$u.test.mobile(value);
},
message: '手机号码不正确',
// blurchange
trigger: ['change', 'blur'],
}
],
} }
}); });
const pic = reactive([]); const pic = reactive([]);
const showSex = ref(false); const showSex = ref(false);
const showDate = ref(false); const showDate = ref(false);
const show1 = ref(false)
const isshow1 = () => {
show1.value = true
}
const animal_type_lists = ref([]);
const initAnimalTypeLists = ()=>{
animalTypeLists().then(res=>{
animal_type_lists.value = res.data;
})
}
initAnimalTypeLists();
const animal_type = ref('');
const leavaType1 = (e) => {
animal_type.value = e.name;
data.formData.animal_type = e.value;
}
// //
const delimg = (i) => { const delimg = (i) => {
@ -192,7 +212,6 @@
// //
const updateImgFn = async () => { const updateImgFn = async () => {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 1,
sizeType: ['original', 'compressed'], sizeType: ['original', 'compressed'],
@ -222,15 +241,18 @@
// data.formData.pic = res.data.image // data.formData.pic = res.data.image
} }
const gender = ref('');
const selectSex = (e)=>{ const selectSex = (e)=>{
data.formData.sex = e.name; if(e.name=='公') data.formData.gender = 1;
else data.formData.gender = 0;
gender.value = e.name;
} }
const changeTime = ref(Date.now()) const changeTime = ref(Date.now())
const selectDate = (e)=>{ const selectDate = (e)=>{
let date = new Date(e.value); let date = new Date(e.value);
if(data.formData.type>1) data.formData.brith_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd'); if(data.formData.type>1) data.formData.brith_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
else data.formData.join_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd'); else data.formData.entry_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
showDate.value = false; showDate.value = false;
} }
@ -265,7 +287,7 @@
// //
addland(data.formData).then((res) => { animalInfoAdd(data.formData).then((res) => {
console.log(res) console.log(res)
if (res.code == 1) { if (res.code == 1) {
uni.navigateBack({ uni.navigateBack({
@ -285,13 +307,15 @@
} }
} }
const animal_source = ref('');//
onLoad((options) => { onLoad((options) => {
if (options.type > 1) { if (options.type > 1) {
data.formData.type = +options.type; data.formData.animal_source = +options.type;
data.formData.type_name = options.name; animal_source.value = options.name;
} else { } else {
data.formData.type = 1; data.formData.animal_source = 1;
data.formData.type_name = '购买'; animal_source.value = '购买';
} }
if(options.id) { if(options.id) {
data.formData.fence_house_id = options.id; data.formData.fence_house_id = options.id;

View File

@ -89,6 +89,9 @@
plantlist, plantlist,
landdetail landdetail
} from '@/api/api.js' } from '@/api/api.js'
import {
animalTypeLists
} from "@/api/dict.js"
import { import {
onLoad, onLoad,
@ -140,6 +143,17 @@
route: "/pages/husbandryForm/harvest" route: "/pages/husbandryForm/harvest"
}] }]
]); ]);
const animal_type_lists = ref([]);
const initAnimalTypeLists = ()=>{
animalTypeLists().then(res=>{
animal_type_lists.value = res.data;
})
}
initAnimalTypeLists();
const getAnimalType = (value)=>{
return animal_type_lists.value.find(item=>item.value==value)?.name || ''
}
onLoad((option) => { onLoad((option) => {
typeID.value = option.id; typeID.value = option.id;

View File

@ -42,26 +42,26 @@
</view> </view>
<u--image src="/static/main/house/xia_yi_ji_btn.png" class="next" width="38rpx" height="38rpx" @click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}`)"></u--image> <u--image src="/static/main/house/xia_yi_ji_btn.png" class="next" width="38rpx" height="38rpx" @click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}`)"></u--image>
<view class="right" style="color: #7B7B7B;" @click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}`)"> <view class="right" style="color: #7B7B7B;" @click="navTo(`/pages/plantAdmin/breedDetail?id=${item.id}`)">
<view class="name">耳号</view> <view class="name">{{item.sn}}</view>
<view class="r-item"> <view class="r-item">
<view class="item-title">品类:</view> <view class="item-title">品类:</view>
<view>黑山羊</view> <view>{{getAnimalType(item.animal_type)}}</view>
</view> </view>
<view class="r-item"> <view class="r-item">
<view class="item-title">品种:</view> <view class="item-title">品种:</view>
<view>山羊</view> <view>{{item.brand}}</view>
</view> </view>
<view class="r-item"> <view class="r-item">
<view class="item-title">性别:</view> <view class="item-title">性别:</view>
<view></view> <view>{{item.gender? '':'母'}}</view>
</view> </view>
<view class="r-item"> <view class="r-item">
<view class="item-title">栏舍:</view> <view class="item-title">栏舍:</view>
<view>栏舍一号</view> <view v-if="item.fenceHouseAttr">{{item.fenceHouseAttr.fence_house_name}}</view>
</view> </view>
<view class="r-item"> <view class="r-item">
<view class="item-title">来源:</view> <view class="item-title">来源:</view>
<view>购买</view> <view>{{item.animal_source==1 ? '购买': '自繁'}}</view>
</view> </view>
</view> </view>
</view> </view>
@ -139,30 +139,23 @@
ref, ref,
reactive reactive
} from "vue" } from "vue"
import { import {
plantlist, plantlist,
landdetail landdetail
} from '@/api/api.js' } from '@/api/api.js'
import { import {
fenceHouseDetail fenceHouseDetail,
animalInfoList,
operationLogIndex
} from "@/api/manage.js" } from "@/api/manage.js"
import { import {
onLoad, onLoad,
onShow onShow
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
const dataList = reactive([{ import {
id: 1, animalTypeLists
name: '栏舍一号', } from "@/api/dict.js"
img: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg', const dataList = reactive([])
animal_name: '山羊',
animal_type: '哺乳动物',
capacity: '50只',
create_by: '张三',
create_time: '2023-12-19',
qr_code: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/76751202312201347169905.png',
showCode: false
}])
const feedDataList = reactive([ const feedDataList = reactive([
{type_name: '喂食'}, {type_name: '喂食'},
{type_name: '喂水'}, {type_name: '喂水'},
@ -195,19 +188,37 @@
}] }]
]); ]);
const animal_type_lists = ref([]);
const initAnimalTypeLists = ()=>{
animalTypeLists().then(res=>{
animal_type_lists.value = res.data;
})
}
initAnimalTypeLists();
const getAnimalType = (value)=>{
return animal_type_lists.value.find(item=>item.value==value)?.name || ''
}
const initOperationLogIndex = ()=>{
operationLogIndex({
fence_house_id: typeID.value
}).then(res=>{
console.log(res);
})
}
onLoad((option) => { onLoad((option) => {
typeID.value = option.id; typeID.value = option.id;
getFenceHouseDetail(); getFenceHouseDetail();
}); });
onShow(() => { onShow(() => {
// getlist(); getlist();
initOperationLogIndex();
}) })
const getFenceHouseDetail = () => { const getFenceHouseDetail = () => {
fenceHouseDetail({ fenceHouseDetail({
id: typeID.value id: typeID.value,
}).then((res) => { }).then((res) => {
if (res.code == 1) { if (res.code == 1) {
Object.assign(dataobj, res.data); Object.assign(dataobj, res.data);
@ -217,15 +228,17 @@
const getlist = () => { const getlist = () => {
plantlist({ animalInfoList({
land_id: typeID.value fence_house_id: typeID.value,
page_no: 1,
page_size: 3
}).then((res) => { }).then((res) => {
if (res.code == 1) { if (res.code == 1) {
dataList.splice(0, dataList.length, ...res.data); dataList.splice(0, dataList.length, ...res.data.lists);
dataList.forEach(item => { dataList.forEach(item => {
item.showCode = false item.showCode = false
}) })
console.log(dataList) // console.log(dataList)
} }
}); });
}; };
@ -257,11 +270,11 @@
if(navType.value==1){ if(navType.value==1){
navTo(`/pages/plantAdmin/addBreed?name=${e.name}&type=${e.name=='购买'?1:2}&id=${dataobj.id}&fence_house_name=${dataobj.fence_house_name}`) navTo(`/pages/plantAdmin/addBreed?name=${e.name}&type=${e.name=='购买'?1:2}&id=${dataobj.id}&fence_house_name=${dataobj.fence_house_name}`)
}else { }else {
if(e.name=='喂食') return navTo(`/pages/feed/feed?id=23&house_id=1`); if(e.name=='喂食') return navTo(`/pages/feed/feed?house_id=${dataobj.id}`);
if(e.name=='喂水') return navTo(`/pages/feed/water?id=23&house_id=1`); if(e.name=='喂水') return navTo(`/pages/feed/water?house_id=${dataobj.id}`);
if(e.name=='消毒') return navTo(`/pages/feed/sterilize?id=23&house_id=1`); if(e.name=='消毒') return navTo(`/pages/feed/sterilize?house_id=${dataobj.id}`);
if(e.name=='疫苗') return navTo(`/pages/feed/vaccine?id=23&house_id=1`); if(e.name=='疫苗') return navTo(`/pages/feed/vaccine?house_id=${dataobj.id}`);
if(e.name=='驱虫') return navTo(`/pages/feed/expelling?id=23&house_id=1`); if(e.name=='驱虫') return navTo(`/pages/feed/expelling?house_id=${dataobj.id}`);
} }
} }

View File

@ -1,15 +1,19 @@
<template> <template>
<view class="box"> <view class="box">
<u-tabs :list="list1" lineColor="#feb048" :scrollable="false"></u-tabs>
<view class="content"> <view class="content">
<view class=""> <view class="">
<block class="" v-if="feedDataList.length>0"> <block class="" v-if="feedDataList.length>0">
<view class="thing-card" v-for="(item,index) in feedDataList" :key="index"> <view class="thing-card" v-for="(item,index) in feedDataList" :key="index">
<view class="card_body"> <view class="card_body">
<view class="left"> <view class="left">
<u--image @click="perviewFn('https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg')" radius='10' src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg" width="200rpx" <u--image
height="200rpx"></u--image> @click="perviewFn('https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg')"
radius='10' src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg"
width="200rpx" height="200rpx"></u--image>
</view> </view>
<u--image src="/static/main/house/xia_yi_ji_btn.png" class="next" width="38rpx" height="38rpx" @click="navFeed(item)"></u--image> <u--image src="/static/main/house/xia_yi_ji_btn.png" class="next" width="38rpx" height="38rpx"
@click="navFeed(item)"></u--image>
<view class="right" style="color: #7B7B7B;" @click="navFeed(item)"> <view class="right" style="color: #7B7B7B;" @click="navFeed(item)">
<view class="r-item"> <view class="r-item">
<view class="item-title">操作类型:</view> <view class="item-title">操作类型:</view>
@ -58,25 +62,37 @@
onShow onShow
} from "@dcloudio/uni-app" } from "@dcloudio/uni-app"
const feedDataList = reactive([ const feedDataList = reactive([
{type_name: '喂食'}, { type_name: '喂食' },
{type_name: '喂水'}, { type_name: '喂水' },
{type_name: '消毒'}, { type_name: '消毒' },
{type_name: '疫苗'}, { type_name: '疫苗' },
{type_name: '驱虫'}, { type_name: '驱虫' },
]) ])
const list1 = reactive([{
name: '喂食',
}, {
name: '喂水',
}, {
name: '消毒'
}, {
name: '疫苗'
}, {
name: '驱虫'
}])
// //
const navTo = (url) => { const navTo = (url) => {
uni.navigateTo({ uni.navigateTo({
url url
}) })
} }
const navFeed = (e)=>{ const navFeed = (e) => {
if(e.type_name=='喂食') navTo(`/pages/feedDetail/feedDetail?id=1`) if (e.type_name == '喂食') navTo(`/pages/feedDetail/feedDetail?id=1`)
if(e.type_name=='喂水') navTo(`/pages/feedDetail/waterDetail?id=1`) if (e.type_name == '喂水') navTo(`/pages/feedDetail/waterDetail?id=1`)
if(e.type_name=='消毒') navTo(`/pages/feedDetail/sterilizeDetail?id=1`) if (e.type_name == '消毒') navTo(`/pages/feedDetail/sterilizeDetail?id=1`)
if(e.type_name=='疫苗') navTo(`/pages/feedDetail/vaccineDetail?id=1`) if (e.type_name == '疫苗') navTo(`/pages/feedDetail/vaccineDetail?id=1`)
if(e.type_name=='驱虫') navTo(`/pages/feedDetail/expellingDetail?id=1`) if (e.type_name == '驱虫') navTo(`/pages/feedDetail/expellingDetail?id=1`)
} }
@ -95,7 +111,6 @@
urls: [url] urls: [url]
}) })
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -200,7 +215,8 @@
.left { .left {
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
.qr-code{
.qr-code {
position: absolute; position: absolute;
right: 10rpx; right: 10rpx;
bottom: 10rpx; bottom: 10rpx;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB