diff --git a/api/dict.js b/api/dict.js index 98ccdce..aca8587 100644 --- a/api/dict.js +++ b/api/dict.js @@ -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 feedingTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'feeding_type'}); + diff --git a/api/manage.js b/api/manage.js index 9441e11..6bee9d2 100644 --- a/api/manage.js +++ b/api/manage.js @@ -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 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); diff --git a/config/app.js b/config/app.js index 0adfaa7..d8539b4 100644 --- a/config/app.js +++ b/config/app.js @@ -8,8 +8,8 @@ let env = "dev" let HTTP_REQUEST_URL let HEADER if (env == 'dev') { - // BASE_URL = 'http://ceshi-suyuan.lihaink.cn/' - BASE_URL = 'http://192.168.1.19:8084/' + BASE_URL = 'https://ceshi-suyuan-breed.lihaink.cn/' + // BASE_URL = 'http://192.168.1.25:8084/' } else if (env = 'prod') { BASE_URL = 'http://ceshi-suyuan.lihaink.cn/' } diff --git a/pages/feed/expelling.vue b/pages/feed/expelling.vue index ac10268..246fb72 100644 --- a/pages/feed/expelling.vue +++ b/pages/feed/expelling.vue @@ -5,21 +5,21 @@ 驱虫信息 - - + + - + + suffix-icon-style="color: #b6b6b6;" v-model="formData.deworming_method" readonly> - - + + - + @@ -89,21 +89,29 @@ import { addaction } from '@/api/api.js' + import { + dewormingLogAdd + } from "@/api/manage.js" const form = ref(null) const task_id = ref(''); const pic = reactive([]); const show1 = ref(false) const formData = reactive({ - user: "", + vermifuge_name: "", + deworming_method: "", + deworming_date: '', + operator: '', remark: "", pic: [], - start_date: '', - fun: '' + fence_house_id: '', + animal_info_id: '', }) + 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 } + const formatter = (type, value) => { if (type === 'year') { return `${value}年`; @@ -117,7 +125,25 @@ return value; }; 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', required: true, message: '请填写参与人', @@ -133,7 +159,7 @@ const showFun = ref(false); const selectFun = (e)=>{ - formData.fun = e.name; + formData.deworming_method = e.name; } onReady(() => { @@ -161,26 +187,19 @@ } const addFn = () => { form.value.validate().then(res => { - console.log(res) if (res) { - formData.pic = pic - let data1 = { - plant_id: task_id.value, - type: 5, - detail: JSON.stringify(formData) - }; - if (formData.pic.length == 0) { + + if (pic.length == 0) { uni.$u.toast('请上传图片') return } - - console.log('表单通过'); + + formData.pic = JSON.stringify(pic) // 表单验证通过,执行提交操作 - addaction(data1).then((res) => { - console.log(res) + dewormingLogAdd(formData).then((res) => { if (res.code == 1) { uni.$u.toast(res.msg) uni.navigateBack({ @@ -242,24 +261,8 @@ } const mode = ref('add') onLoad((options) => { - if (options.task) { - let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; - // 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 - } - - + formData.fence_house_id = options.house_id; + formData.animal_info_id = options.id; }) diff --git a/pages/feed/feed.vue b/pages/feed/feed.vue index 7812656..ee93440 100644 --- a/pages/feed/feed.vue +++ b/pages/feed/feed.vue @@ -6,27 +6,28 @@ 喂食信息 - - + + - - + + - + + border="none" v-model="formData.feed_consumption"> - - + + - + @@ -73,6 +74,9 @@ 完成添加 + + @@ -94,16 +98,26 @@ import { addaction } from '@/api/api.js' + import { + feedingTypeLists + } from "@/api/dict.js" + import { + feedingLogAdd + } from "@/api/manage.js" const form = ref(null) const task_id = ref(''); const pic = reactive([]); const show1 = ref(false) const formData = reactive({ - user: "", + feed_type: "", + feed_brand: "", + feed_consumption: "", + operator: '', remark: "", pic: [], - start_date: '' + fence_house_id: '', + animal_info_id: '', }) const dateConfirmfn = (e) => { formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') @@ -122,10 +136,10 @@ return value; }; const rules = { - 'user': { + 'feed_type': { type: 'string', required: true, - message: '请填写参与人', + message: '请选择饲料种类', trigger: ['blur', 'change'] }, // 'remark': { @@ -159,32 +173,40 @@ 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 = () => { form.value.validate().then(res => { console.log(res) if (res) { - - - - formData.pic = pic - let data1 = { - plant_id: task_id.value, - type: 5, - detail: JSON.stringify(formData) - }; - if (formData.pic.length == 0) { - - uni.$u.toast('请上传图片') - return + if (pic.length == 0) { + + uni.$u.toast('请上传图片') + return } - - console.log('表单通过'); + + formData.pic = JSON.stringify(pic) // 表单验证通过,执行提交操作 - addaction(data1).then((res) => { - console.log(res) + feedingLogAdd(formData).then((res) => { if (res.code == 1) { uni.$u.toast(res.msg) uni.navigateBack({ @@ -250,24 +272,8 @@ } const mode = ref('add') onLoad((options) => { - if (options.task) { - let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; - // 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 - } - - + formData.fence_house_id = options.house_id; + formData.animal_info_id = options.id; }) diff --git a/pages/feed/sterilize.vue b/pages/feed/sterilize.vue index 2883e58..c9439df 100644 --- a/pages/feed/sterilize.vue +++ b/pages/feed/sterilize.vue @@ -5,31 +5,31 @@ 消毒信息 - + + v-model="formData.disinfectant_name"> - + + v-model="formData.concentration"> - + + v-model="formData.disinfectant_method"> - + + suffix-icon-style="color: #b6b6b6;" v-model="formData.disinfectant_area" readonly> - + + v-model="formData.operator"> - + @@ -102,14 +102,19 @@ const pic = reactive([]); const show1 = ref(false) const formData = reactive({ - user: "", + disinfectant_name: "", + concentration: "", + disinfectant_method: "", + disinfectant_area: "", + disinfectant_date: '', + operator: '', remark: "", pic: [], - start_date: '', - fun: '' + fence_house_id: '', + animal_info_id: '', }) 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 } const formatter = (type, value) => { @@ -141,7 +146,7 @@ const showFun = ref(false); const selectFun = (e)=>{ - formData.fun = e.name; + formData.deworming_method = e.name; } onReady(() => { @@ -250,24 +255,8 @@ } const mode = ref('add') onLoad((options) => { - if (options.task) { - let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; - // 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 - } - - + formData.fence_house_id = options.house_id; + formData.animal_info_id = options.id; }) diff --git a/pages/feed/vaccine.vue b/pages/feed/vaccine.vue index 269b6b4..5c61be6 100644 --- a/pages/feed/vaccine.vue +++ b/pages/feed/vaccine.vue @@ -5,39 +5,43 @@ 疫苗信息 - + + + + + + v-model="formData.vaccine_manufacturers"> - + + v-model="formData.vaccine_batch"> - + + suffix-icon-style="color: #b6b6b6;" v-model="vaccination_method" readonly> - + + suffix-icon-style="color: #b6b6b6;" v-model="vaccination_site" readonly> - + + v-model="formData.immune_validity_period"> - + + v-model="formData.operator"> - + @@ -109,16 +113,25 @@ import { addaction } from '@/api/api.js' + import { + vaccinumLogAdd + } from "@/api/manage.js" const form = ref(null) const task_id = ref(''); const pic = reactive([]); const show1 = ref(false) const formData = reactive({ - user: "", + vaccine_name: "", + vaccine_manufacturers: "", + vaccine_batch: "", + vaccination_method: "", + vaccination_site: '', + immune_validity_period: "", + operator: '', remark: "", pic: [], - start_date: '', - fun: '' + fence_house_id: '', + animal_info_id: '', }) const dateConfirmfn = (e) => { formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') @@ -152,12 +165,18 @@ } const showFun = ref(false); + const vaccination_method = ref(''); 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 vaccination_site = ref(''); 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 selectName = (e)=>{ @@ -191,23 +210,17 @@ form.value.validate().then(res => { console.log(res) if (res) { - formData.pic = pic - let data1 = { - plant_id: task_id.value, - type: 5, - detail: JSON.stringify(formData) - }; - if (formData.pic.length == 0) { - + if (pic.length == 0) { + uni.$u.toast('请上传图片') return } - - console.log('表单通过'); + + formData.pic = JSON.stringify(pic) // 表单验证通过,执行提交操作 - addaction(data1).then((res) => { + vaccinumLogAdd(formData).then((res) => { console.log(res) if (res.code == 1) { uni.$u.toast(res.msg) @@ -270,24 +283,8 @@ } const mode = ref('add') onLoad((options) => { - if (options.task) { - let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; - // 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 - } - - + formData.fence_house_id = options.house_id; + formData.animal_info_id = options.id; }) diff --git a/pages/feed/water.vue b/pages/feed/water.vue index 82c3e0a..61b2085 100644 --- a/pages/feed/water.vue +++ b/pages/feed/water.vue @@ -5,19 +5,19 @@ 喂水信息 - + + border="none" v-model="formData.water_consumption"> - + + border="none" v-model="formData.operator"> - + @@ -85,16 +85,21 @@ import { addaction } from '@/api/api.js' + import { + waterLogAdd + } from '@/api/manage.js' const form = ref(null) const task_id = ref(''); const pic = reactive([]); const show1 = ref(false) const formData = reactive({ - user: "", + water_consumption: "", + operator: '', remark: "", pic: [], - start_date: '' + fence_house_id: '', + animal_info_id: '', }) const dateConfirmfn = (e) => { formData.start_date = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM ') @@ -154,27 +159,16 @@ form.value.validate().then(res => { console.log(res) if (res) { - - - - - formData.pic = pic - let data1 = { - plant_id: task_id.value, - type: 5, - detail: JSON.stringify(formData) - }; - if (formData.pic.length == 0) { - - uni.$u.toast('请上传图片') - return - } - - console.log('表单通过'); - + if (pic.length == 0) { + + uni.$u.toast('请上传图片') + return + } + + formData.pic = JSON.stringify(pic) // 表单验证通过,执行提交操作 - addaction(data1).then((res) => { + waterLogAdd(formData).then((res) => { console.log(res) if (res.code == 1) { uni.$u.toast(res.msg) @@ -241,24 +235,8 @@ } const mode = ref('add') onLoad((options) => { - if (options.task) { - let data = options.task ? JSON.parse(decodeURIComponent(options.task)) : null; - // 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 - } - - + formData.fence_house_id = options.house_id; + formData.animal_info_id = options.id; }) diff --git a/pages/index/massif.vue b/pages/index/massif.vue index b227db7..5943da0 100644 --- a/pages/index/massif.vue +++ b/pages/index/massif.vue @@ -99,15 +99,96 @@ 智能监测数据 - - - {{item.name}} - - - {{ item.num?item.num+item.unit:'--' }} - - + + + 空气温度 + + + {{ monitorData.ambient_temperature || monitorData.ambient_temperature === 0 ? monitorData.ambient_temperature + '℃':'--' }} + + + ↑ {{ compDatas(monitorData.ambient_temperature, monitorThreshold.air_temp_max) }}{{'℃'}} + + + ↓ {{ compDatas(monitorThreshold.air_temp_min, monitorData.ambient_temperature) }}{{'℃'}} + + + + + 空气湿度 + + + {{ monitorData.ambient_humidity || monitorData.ambient_humidity === 0 ? monitorData.ambient_humidity + '%':'--' }} + + + ↑ {{ compDatas(monitorData.ambient_humidity, monitorThreshold.air_mois_max) }}{{'%'}} + + + ↓ {{ compDatas(monitorThreshold.air_mois_min, monitorData.ambient_humidity) }}{{'%'}} + + + + + 氮气 + + + {{ monitorData.nitrogen || monitorData.nitrogen === 0 ? monitorData.nitrogen + 'ppm':'--' }} + + + ↑ {{ compDatas(monitorData.nitrogen, monitorThreshold.nitrogen_max) }}{{'ppm'}} + + + ↓ {{ compDatas(monitorThreshold.nitrogen_min, monitorData.nitrogen) }}{{'ppm'}} + + + + + 甲烷 + + + {{ monitorData.methane || monitorData.methane === 0 ? monitorData.methane + 'ppm':'--' }} + + + ↑ {{ compDatas(monitorData.methane, monitorThreshold.methane_max) }}{{'ppm'}} + + + ↓ {{ compDatas(monitorThreshold.methane_min, monitorData.methane) }}{{'ppm'}} + + + + + 噪音 + + + {{ monitorData.noise || monitorData.noise === 0 ? monitorData.noise + 'db' : '--' }} + + + ↑ {{ compDatas(monitorData.noise, monitorThreshold.noise_max) }}{{'db'}} + + + ↓ {{ compDatas(monitorThreshold.noise_min, monitorData.noise) }}{{'db'}} + + + + + 防火 + + + {{ monitorData.fireproof || monitorData.fireproof === 0 ? monitorData.fireproof : '--' }} + + + ↑ {{ compDatas(monitorData.fireproof, monitorThreshold.fireproof_max) }} + + + ↓ {{ compDatas(monitorThreshold.fireproof_min, monitorData.fireproof) }} + + @@ -154,8 +235,6 @@ - @@ -185,61 +264,18 @@ 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 range = reactive([]) - // 土壤监测数据 - const url = ref('https://ceshi-worker-task.lihaink.cn//uploads//images//20231121//202311211336582b7920656.jpg') - const soilList = reactive([{ - icon: "huan_jing_wen_du", - name: "空气温度", - num: 0, - unit: "℃", - - }, { - 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 compDatas = (a, b)=>{ + try{ + let c = a - b; + return c.toFixed(2) + }catch(e){ + return '0.00' + } + } const userInfo = ref({}); onLoad(() => { @@ -283,6 +319,7 @@ }) } const video_url = ref() + const videoCover = ref('') const show = ref(false) const showLoading = ref(false) @@ -372,7 +409,7 @@ 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 = {}; store.commit('setHouse', houseInfo.value); getlist(); @@ -387,7 +424,9 @@ }) // 监测数据 - const monitor = ref({}); + const monitorData = ref({}); + // 数据阈值 + const monitorThreshold = ref({}); //列表获取 const getlist = () => { @@ -395,7 +434,8 @@ fence_house_id: houseInfo.value.id }).then(res=>{ 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; background-size: 100% 100%; 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-right: 10rpx; } + \ No newline at end of file diff --git a/pages/plantAdmin/addBreed.vue b/pages/plantAdmin/addBreed.vue index 2980538..42d9fbb 100644 --- a/pages/plantAdmin/addBreed.vue +++ b/pages/plantAdmin/addBreed.vue @@ -5,63 +5,64 @@ 养殖信息 - - + + - - + + - - + + - + + suffix-icon-style="color: #b6b6b6;" v-model="gender" readonly> - + + v-model="data.formData.physi_stage"> - + + v-model="data.formData.blood_purity"> - + - + - + + v-model="data.formData.current_estimation"> - + + suffix-icon-style="color: #b6b6b6;" v-model="data.formData.entry_date"> - + - + + v-model="data.formData.fence_house_name"> - + + v-model="data.formData.algebra"> - + + v-model="data.formData.current_estimation"> - + + v-model="data.formData.birth_estimation"> - + + 提交 @@ -126,17 +130,32 @@ import { Uploads } from "@/api/upload.js" + import { + animalTypeLists, + fenceHouseTypeLists + } from "@/api/dict.js" + import { + animalInfoAdd + } from "@/api/manage.js" const form1 = ref(null); const data = reactive({ formData: { fence_house_id: '', //栏舍id - title: '', - sex: '', - type: 1, - brith_date: '', //出生日期 - join_date: '', //入场日期 - type_name: '购买', // 来源 + sn: '', + animal_type: '', + brand: '', + physi_stage: '', + gender: '', + blood_purity: '', + current_estimation: '', + algebra: '', + birth: '', + entry_date: '', + birth_estimation: '', + health_condition: '', + type: 1, // 1-购买 + animal_source: '2', // 来源 1: 购买 2: 自己繁殖 master_name: '', master_phone: '', pic: ['https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80', @@ -144,46 +163,47 @@ ] }, rules: { - title: [{ + fence_house_id: [{ type: 'string', required: true, - message: '请填写养殖基地名称', + message: '请选择栏舍', trigger: ['blur', 'change'] }], - area: [{ + sn: [{ type: 'string', required: true, - message: '请填写养殖基地面积', + message: '请输入耳号', trigger: ['blur', 'change'] }], - master_name: [{ + animal_type: [{ type: 'string', required: true, - message: '请输入养殖基地负责人名称', + message: '请选择品类', trigger: ['blur', 'change'] }], - master_phone: [{ - required: true, - message: '请输入手机号', - trigger: ['change', 'blur'], - }, - { - validator: (rule, value, callback) => { - // 上面有说,返回true表示校验通过,返回false表示不通过 - // uni.$u.test.mobile()就是返回true或者false的 - return uni.$u.test.mobile(value); - }, - message: '手机号码不正确', - // 触发器可以同时用blur和change - trigger: ['change', 'blur'], - } - ], } }); const pic = reactive([]); const showSex = 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) => { @@ -192,7 +212,6 @@ //图片上传 const updateImgFn = async () => { - uni.chooseImage({ count: 1, sizeType: ['original', 'compressed'], @@ -222,15 +241,18 @@ // data.formData.pic = res.data.image } + const gender = ref(''); 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 selectDate = (e)=>{ let date = new Date(e.value); 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; } @@ -265,7 +287,7 @@ // 表单验证通过,执行提交操作 - addland(data.formData).then((res) => { + animalInfoAdd(data.formData).then((res) => { console.log(res) if (res.code == 1) { uni.navigateBack({ @@ -285,13 +307,15 @@ } } + const animal_source = ref('');//来源 + onLoad((options) => { if (options.type > 1) { - data.formData.type = +options.type; - data.formData.type_name = options.name; + data.formData.animal_source = +options.type; + animal_source.value = options.name; } else { - data.formData.type = 1; - data.formData.type_name = '购买'; + data.formData.animal_source = 1; + animal_source.value = '购买'; } if(options.id) { data.formData.fence_house_id = options.id; diff --git a/pages/plantAdmin/breedDetail.vue b/pages/plantAdmin/breedDetail.vue index d5259a0..4589a45 100644 --- a/pages/plantAdmin/breedDetail.vue +++ b/pages/plantAdmin/breedDetail.vue @@ -89,6 +89,9 @@ plantlist, landdetail } from '@/api/api.js' + import { + animalTypeLists + } from "@/api/dict.js" import { onLoad, @@ -140,6 +143,17 @@ 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) => { typeID.value = option.id; diff --git a/pages/plantAdmin/houseDetail.vue b/pages/plantAdmin/houseDetail.vue index d979604..ed32f25 100644 --- a/pages/plantAdmin/houseDetail.vue +++ b/pages/plantAdmin/houseDetail.vue @@ -42,26 +42,26 @@ - 耳号 + {{item.sn}} 品类: - 黑山羊 + {{getAnimalType(item.animal_type)}} 品种: - 山羊 + {{item.brand}} 性别: - + {{item.gender? '公':'母'}} 栏舍: - 栏舍一号 + {{item.fenceHouseAttr.fence_house_name}} 来源: - 购买 + {{item.animal_source==1 ? '购买': '自繁'}} @@ -139,30 +139,23 @@ ref, reactive } from "vue" - import { plantlist, landdetail } from '@/api/api.js' import { - fenceHouseDetail + fenceHouseDetail, + animalInfoList, + operationLogIndex } from "@/api/manage.js" import { onLoad, onShow } from "@dcloudio/uni-app" - const dataList = reactive([{ - id: 1, - name: '栏舍一号', - img: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/91fb0202311021455371420.jpg', - 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 - }]) + import { + animalTypeLists + } from "@/api/dict.js" + const dataList = reactive([]) const feedDataList = reactive([ {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) => { typeID.value = option.id; getFenceHouseDetail(); }); onShow(() => { - // getlist(); + getlist(); + initOperationLogIndex(); }) const getFenceHouseDetail = () => { fenceHouseDetail({ - id: typeID.value + id: typeID.value, }).then((res) => { if (res.code == 1) { Object.assign(dataobj, res.data); @@ -217,15 +228,17 @@ const getlist = () => { - plantlist({ - land_id: typeID.value + animalInfoList({ + fence_house_id: typeID.value, + page_no: 1, + page_size: 3 }).then((res) => { if (res.code == 1) { - dataList.splice(0, dataList.length, ...res.data); + dataList.splice(0, dataList.length, ...res.data.lists); dataList.forEach(item => { item.showCode = false }) - console.log(dataList) + // console.log(dataList) } }); }; @@ -257,11 +270,11 @@ 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}`) }else { - if(e.name=='喂食') return navTo(`/pages/feed/feed?id=23&house_id=1`); - if(e.name=='喂水') return navTo(`/pages/feed/water?id=23&house_id=1`); - if(e.name=='消毒') return navTo(`/pages/feed/sterilize?id=23&house_id=1`); - if(e.name=='疫苗') return navTo(`/pages/feed/vaccine?id=23&house_id=1`); - if(e.name=='驱虫') return navTo(`/pages/feed/expelling?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?house_id=${dataobj.id}`); + if(e.name=='消毒') return navTo(`/pages/feed/sterilize?house_id=${dataobj.id}`); + if(e.name=='疫苗') return navTo(`/pages/feed/vaccine?house_id=${dataobj.id}`); + if(e.name=='驱虫') return navTo(`/pages/feed/expelling?house_id=${dataobj.id}`); } } diff --git a/pages/plantAdmin/moreFeed.vue b/pages/plantAdmin/moreFeed.vue index 2610603..0e244cc 100644 --- a/pages/plantAdmin/moreFeed.vue +++ b/pages/plantAdmin/moreFeed.vue @@ -1,15 +1,19 @@