This commit is contained in:
parent
2c6ba3959f
commit
0c36432c23
|
@ -42,6 +42,7 @@ export const listForType = (data) => syhttp.get('/action/listForType', data)
|
|||
|
||||
//首页
|
||||
export const lindexist = (data) => syhttp.get('/index/index', data)
|
||||
|
||||
//产品列表
|
||||
export const landproduct = (data) => syhttp.get('/land/product', data)
|
||||
|
||||
|
|
|
@ -8,3 +8,10 @@ export const farmTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_v
|
|||
|
||||
//养殖种类
|
||||
export const breedTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'breed_type'});
|
||||
|
||||
//栏舍类型
|
||||
export const fenceHouseTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'fence_house_type'});
|
||||
|
||||
//动物类型
|
||||
export const animalTypeLists = () => syhttp.get('/common/dict_data_lists_by_type_value', {type_value: 'animal_type'});
|
||||
|
||||
|
|
|
@ -24,3 +24,7 @@ export const farmTypeLists = (data) => syhttp.get('/farm_type', data);
|
|||
|
||||
//新增养殖基地
|
||||
export const farmAdd = (data) => syhttp.post('/farm/add', data);
|
||||
|
||||
//养殖基地列表
|
||||
export const fenceHouseData = (data) => syhttp.get('/fence_house/datas', data);
|
||||
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import syhttp from "@/utils/syhttp.js";
|
||||
import http from "@/utils/http.js";
|
||||
|
||||
|
||||
//新增栏舍
|
||||
export const fenceHouseAdd = (data) => syhttp.post('/fence_house/add', data);
|
||||
|
||||
//栏舍列表
|
||||
export const fenceHouseList = (data) => syhttp.get('/fence_house/list', data);
|
||||
|
||||
//栏舍详情
|
||||
export const fenceHouseDetail = (data) => syhttp.get('/fence_house/detail', data);
|
||||
|
|
@ -2,32 +2,32 @@
|
|||
<view class="" style="margin-top: 10rpx;">
|
||||
<view class="" style="display: flex;align-items: center;height: 60rpx;">
|
||||
<u-icon name="map"></u-icon>
|
||||
栏舍一号
|
||||
{{info.fence_house_name}}
|
||||
</view>
|
||||
|
||||
<view class="info">
|
||||
<view class="info-li" style="background-image: url('/static/main/house/dong_wu_ming_cheng.png');">
|
||||
动物名称
|
||||
<view class="">
|
||||
黑山羊
|
||||
{{info.animal_name}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-li" style="background-image: url('/static/main/house/dong_wu_lei_xing.png');">
|
||||
动物类型
|
||||
<view class="">
|
||||
哺乳动物
|
||||
{{getAnimalType(info.animal_type)}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-li" style="background-image: url('/static/main/house/lan_she_rong_liang.png');">
|
||||
栏舍容量
|
||||
<view class="">
|
||||
50只
|
||||
{{info.capacity}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-li" style="background-image: url('/static/main/house/lan_she_fu_ze_ren.png');">
|
||||
栏舍负责人
|
||||
<view class="">
|
||||
赵桑
|
||||
{{info.master}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-li" style="background-image: url('/static/main/house/dian_hua.png');">
|
||||
|
@ -46,15 +46,29 @@
|
|||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
watch
|
||||
|
||||
watch,
|
||||
ref
|
||||
} from "vue";
|
||||
import {
|
||||
animalTypeLists
|
||||
} from "@/api/dict.js"
|
||||
const props = defineProps({
|
||||
info: Object,
|
||||
isDetail: Boolean
|
||||
|
||||
})
|
||||
|
||||
const animal_type_lists = ref([])
|
||||
const initAnimalTypeLists = ()=>{
|
||||
animalTypeLists().then(res=>{
|
||||
animal_type_lists.value = res.data;
|
||||
})
|
||||
}
|
||||
initAnimalTypeLists();
|
||||
const getAnimalType = (type)=>{
|
||||
return animal_type_lists.value.find(item=>item.value==type)?.name||'';
|
||||
}
|
||||
|
||||
const perviewFn = (url) => {
|
||||
|
||||
uni.previewImage({
|
||||
|
|
|
@ -9,7 +9,7 @@ let HTTP_REQUEST_URL
|
|||
let HEADER
|
||||
if (env == 'dev') {
|
||||
// BASE_URL = 'http://ceshi-suyuan.lihaink.cn/'
|
||||
BASE_URL = 'http://192.168.1.6:8084/'
|
||||
BASE_URL = 'http://192.168.1.13:8084/'
|
||||
} else if (env = 'prod') {
|
||||
BASE_URL = 'http://ceshi-suyuan.lihaink.cn/'
|
||||
}
|
||||
|
|
|
@ -7,23 +7,19 @@
|
|||
|
||||
<Myindex style="float: right;"></Myindex>
|
||||
|
||||
<view class="" v-show="false">
|
||||
<image src="/static/tabs-icon/dk.png"></image>
|
||||
</view>
|
||||
|
||||
<view class="content">
|
||||
<view class="tit">
|
||||
您好!
|
||||
</view>
|
||||
<view class="tit" style="margin-bottom: 60rpx;">
|
||||
欢迎进入吟龙土壤墒情监测系统!
|
||||
欢迎进入吟龙养殖测溯系统!
|
||||
</view>
|
||||
|
||||
<view class="input-card">
|
||||
<view class="card-head">
|
||||
<!-- <view class="triangle top" />
|
||||
<view class="triangle bottom" /> -->
|
||||
<view class="code-login" @click="changeLoginType(0)" :class="{act_code:loginType==0}">
|
||||
<view class="code-login" @click="changeLoginType(0)" :class="{act_code:loginType==2}">
|
||||
<span>验证码登录</span>
|
||||
|
||||
</view>
|
||||
|
@ -247,7 +243,7 @@
|
|||
height: 50px;
|
||||
background-color: transparent;
|
||||
box-sizing: border-box;
|
||||
background-image: url("/static/main/index/white_bg.png");
|
||||
// background-image: url("/static/main/index/white_bg.png");
|
||||
background-size: 100% 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -255,7 +251,8 @@
|
|||
align-items: center;
|
||||
padding: 20rpx;
|
||||
transition: 500ms;
|
||||
color: black;
|
||||
// color: black;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
|
||||
|
@ -299,9 +296,9 @@
|
|||
// background-color: white;
|
||||
// color: white;
|
||||
color: black;
|
||||
font-weight: normal;
|
||||
font-weight: bold;
|
||||
// background-image: url('/static/main/index/login_ad.png');
|
||||
// background-image: url('/static/main/index/white_bg.png');
|
||||
background-image: url('/static/main/index/white_bg.png');
|
||||
}
|
||||
|
||||
.act_password {
|
||||
|
@ -545,8 +542,6 @@
|
|||
}
|
||||
//登录
|
||||
const submitFn = () => {
|
||||
|
||||
|
||||
if (!formData.account) return uni.$u.toast('账号不能为空');
|
||||
if (!formData.password && formData.scene == 1) return uni.$u.toast('密码不能为空');
|
||||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(formData.account)) return uni.$u.toast(
|
||||
|
@ -554,21 +549,19 @@
|
|||
);
|
||||
// console.log(formData)
|
||||
if (!formData.code && formData.scene == 2) return uni.$u.toast('验证码不能为空');
|
||||
login(formData).then((res) => {
|
||||
if (res.code == 1) {
|
||||
uni.showLoading({
|
||||
title: '登陆中'
|
||||
})
|
||||
login(formData).then((res) => {
|
||||
if (res.code == 1) {
|
||||
stores.dispatch('saveUserInfo', res.data)
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
store.dispatch('changeTabbar', 0)
|
||||
uni.switchTab({
|
||||
url: '/pages/index/massif'
|
||||
})
|
||||
console.log(store.state.tabbrIndex, "tabbar")
|
||||
// console.log(store.state.tabbrIndex, "tabbar")
|
||||
uni.$u.toast('登录成功');
|
||||
}, 500)
|
||||
|
||||
}
|
||||
|
||||
|
@ -605,7 +598,5 @@
|
|||
}
|
||||
onMounted(() => {
|
||||
checkUserAgent()
|
||||
|
||||
|
||||
})
|
||||
</script>
|
|
@ -15,7 +15,7 @@
|
|||
您好!
|
||||
</view>
|
||||
<view class="tit">
|
||||
欢迎进入吟龙土壤墒情监测溯系统!
|
||||
欢迎进入吟龙养殖测溯系统!
|
||||
</view>
|
||||
<view class="input-card" style="color: #7A7A7A;">
|
||||
<view class="login-type" style="color: black;font-weight: bold;">
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
style="pointer-events: none;"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="养殖基地规模(亩)" prop="form_scale" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入养殖基地规模" border="none"
|
||||
<up-input input-align="right" placeholder="请输入养殖基地规模" type="number" border="none"
|
||||
v-model="data.formData.form_scale"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="负责人" prop="master" borderBottom required>
|
||||
|
@ -43,21 +43,33 @@
|
|||
|
||||
<view class="c-title">地址信息</view>
|
||||
<view class="c-box">
|
||||
<up-form-item label="所在省份" prop="province" borderBottom required @click="isshow1">
|
||||
<up-form-item label="所在省份" prop="province" borderBottom required @click="isshow">
|
||||
<up-input input-align="right" placeholder="请选择所在省份" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="province_name" readonly
|
||||
style="pointer-events: none;"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="所在城市" prop="city" borderBottom required @click="isshow2">
|
||||
<up-form-item label="所在城市" prop="city" borderBottom required @click="isshow1">
|
||||
<up-input input-align="right" placeholder="请选择所在城市" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="city_name" readonly
|
||||
style="pointer-events: none;"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="所在区县" prop="area" borderBottom required @click="isshow3">
|
||||
<up-form-item label="所在区县" prop="area" borderBottom required @click="isshow2">
|
||||
<up-input input-align="right" placeholder="请选择所在区县" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="area_name" readonly
|
||||
style="pointer-events: none;"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="所在镇街" prop="formData.street" borderBottom required @click="isshow3">
|
||||
<up-input input-align="right" placeholder="请选择所在镇街" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="street_name"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="所在乡村" prop="formData.village" borderBottom required @click="isshow4">
|
||||
<up-input input-align="right" placeholder="请选择所在乡村" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="village_name"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="所在小队" prop="formData.bridge" borderBottom required @click="isshow5">
|
||||
<up-input input-align="right" placeholder="请选择所在小队" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="bridge_name"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="养殖基地详细地址" prop="address" style="position: relative;" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入养殖基地详细地址" suffixIcon="map"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="data.formData.address">
|
||||
|
@ -100,14 +112,23 @@
|
|||
</view>
|
||||
</up-form>
|
||||
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
|
||||
@close="show = false" @select="leavaType1">
|
||||
@close="show = false" @select="leavaType">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show1" keyName="name" :actions="columns1" title="请选择" @close="show1 = false"
|
||||
@select="leavaType2">
|
||||
@select="leavaType1">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show2" keyName="name" :actions="columns2" title="请选择" @close="show2 = false"
|
||||
@select="leavaType2">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show3" keyName="name" :actions="columns3" title="请选择" @close="show3 = false"
|
||||
@select="leavaType3">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show4" keyName="name" :actions="columns4" title="请选择" @close="show4 = false"
|
||||
@select="leavaType4">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show5" keyName="name" :actions="columns5" title="请选择" @close="show5 = false"
|
||||
@select="leavaType5">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="showFarm" keyName="name" :actions="farm_tpye_list" title="请选择" @close="showFarm = false"
|
||||
@select="selectFarmType">
|
||||
</u-action-sheet>
|
||||
|
@ -163,11 +184,14 @@
|
|||
province: '',
|
||||
city: '',
|
||||
area: '',
|
||||
street: '',
|
||||
village: '',
|
||||
bridge: '',
|
||||
address: '',
|
||||
lat: "",
|
||||
lon: "",
|
||||
master_name: '',
|
||||
pic: []
|
||||
image: []
|
||||
},
|
||||
rules: {
|
||||
farm_name: [{
|
||||
|
@ -212,6 +236,24 @@
|
|||
message: '请选择所在区县',
|
||||
trigger: 'change'
|
||||
}],
|
||||
street: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择所在镇街',
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
village: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择所在乡村',
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
bridge: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择小队',
|
||||
trigger: ['blur', 'change']
|
||||
},
|
||||
address: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
|
@ -247,17 +289,26 @@
|
|||
const province_name = ref(null)
|
||||
const city_name = ref(null)
|
||||
const area_name = ref(null)
|
||||
const street_name = ref(null)
|
||||
const village_name = ref(null)
|
||||
const bridge_name = ref(null)
|
||||
const farm_type_name = ref(null)
|
||||
const breed_type_name = ref(null)
|
||||
|
||||
const show = ref(false)
|
||||
const show1 = ref(false)
|
||||
const show2 = ref(false)
|
||||
const show3 = ref(false)
|
||||
const show4 = ref(false)
|
||||
const show5 = ref(false)
|
||||
const showFarm = ref(false)
|
||||
const showBreed = ref(false)
|
||||
const columns = reactive([])
|
||||
const columns1 = reactive([])
|
||||
const columns2 = reactive([])
|
||||
const columns3 = reactive([])
|
||||
const columns4 = reactive([])
|
||||
const columns5 = reactive([])
|
||||
const farm_tpye_list = reactive([])
|
||||
const breed_tpye_list = reactive([])
|
||||
|
||||
|
@ -275,7 +326,6 @@
|
|||
}
|
||||
|
||||
const cityn = (id) => {
|
||||
|
||||
city({
|
||||
province_code: id
|
||||
}).then((res) => {
|
||||
|
@ -302,6 +352,48 @@
|
|||
});
|
||||
}
|
||||
|
||||
const townsn = (id) => {
|
||||
towns({
|
||||
county_code: id
|
||||
}).then((res) => {
|
||||
columns3.splice(0, columns.length, ...res.data.map((step, index) => {
|
||||
return {
|
||||
name: step.town_name,
|
||||
id: step.town_code,
|
||||
|
||||
};
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const villagesn = (id) => {
|
||||
villages({
|
||||
town_code: id
|
||||
}).then((res) => {
|
||||
columns4.splice(0, columns.length, ...res.data.map((step, index) => {
|
||||
return {
|
||||
name: step.village_name,
|
||||
id: step.village_code,
|
||||
|
||||
};
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
const groupsn = () => {
|
||||
groups().then((res) => {
|
||||
columns5.splice(0, columns.length, ...res.data.map((step, index) => {
|
||||
return {
|
||||
name: step.group_name,
|
||||
id: step.group_code,
|
||||
};
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
const farmTypeListsn = (id) => {
|
||||
farmTypeLists().then((res) => {
|
||||
farm_tpye_list.splice(0, farm_tpye_list.length, ...res.data.map((step, index) => {
|
||||
|
@ -382,15 +474,24 @@
|
|||
|
||||
// 地址 省 市 街道 乡村 小队
|
||||
|
||||
const isshow1 = () => {
|
||||
const isshow = () => {
|
||||
show.value = true
|
||||
}
|
||||
const isshow2 = () => {
|
||||
const isshow1 = () => {
|
||||
show1.value = true
|
||||
}
|
||||
const isshow3 = () => {
|
||||
const isshow2 = () => {
|
||||
show2.value = true
|
||||
}
|
||||
const isshow3 = () => {
|
||||
show3.value = true
|
||||
}
|
||||
const isshow4 = () => {
|
||||
show4.value = true
|
||||
}
|
||||
const isshow5 = () => {
|
||||
show5.value = true
|
||||
}
|
||||
|
||||
const isshowFarm = () =>{
|
||||
showFarm.value = true
|
||||
|
@ -400,21 +501,39 @@
|
|||
showBreed.value = true
|
||||
}
|
||||
|
||||
const leavaType1 = (e) => {
|
||||
const leavaType = (e) => {
|
||||
console.log(e);
|
||||
province_name.value = e.name
|
||||
data.formData.province = e.id
|
||||
cityn(e.id)
|
||||
}
|
||||
const leavaType2 = (e) => {
|
||||
const leavaType1 = (e) => {
|
||||
city_name.value = e.name
|
||||
data.formData.city = e.id
|
||||
countyn(e.id)
|
||||
}
|
||||
|
||||
const leavaType3 = (e) => {
|
||||
const leavaType2 = (e) => {
|
||||
area_name.value = e.name
|
||||
data.formData.area = e.id
|
||||
townsn(e.id)
|
||||
}
|
||||
|
||||
const leavaType3 = (e) => {
|
||||
street_name.value = e.name
|
||||
data.formData.street = e.id
|
||||
villagesn(e.id)
|
||||
}
|
||||
|
||||
const leavaType4 = (e) => {
|
||||
village_name.value = e.name
|
||||
data.formData.village = e.id
|
||||
groupsn()
|
||||
}
|
||||
|
||||
const leavaType5 = (e) => {
|
||||
bridge_name.value = e.name
|
||||
data.formData.bridge = e.id
|
||||
}
|
||||
|
||||
|
||||
|
@ -453,7 +572,7 @@
|
|||
uni.$u.toast('请上传图片')
|
||||
return
|
||||
}
|
||||
data.formData.pic = JSON.stringify(pic)
|
||||
data.formData.image = JSON.stringify(pic)
|
||||
|
||||
// 表单验证通过,执行提交操作
|
||||
farmAdd(data.formData).then((res) => {
|
||||
|
|
|
@ -60,14 +60,14 @@
|
|||
<view class="land-area">
|
||||
<view class="land-title">养殖基地规模</view>
|
||||
<view class="">
|
||||
{{dataobj.form_scale|| "--"}}
|
||||
{{dataobj.form_scale|| "--"}}亩
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view class="plant-area">
|
||||
<view class="land-title">养殖种类</view>
|
||||
<view class="">
|
||||
{{dataobj.total_area-dataobj.residual_area||"--"}}
|
||||
{{farm_type||"--"}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -130,8 +130,7 @@
|
|||
</view>
|
||||
<u-loading-page :loading="showLoading"></u-loading-page>
|
||||
|
||||
|
||||
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
|
||||
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="houseList" title="请选择"
|
||||
@close="show = false" @select="confirm">
|
||||
</u-action-sheet>
|
||||
</view>
|
||||
|
@ -178,7 +177,8 @@
|
|||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref
|
||||
ref,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad,
|
||||
|
@ -192,12 +192,14 @@
|
|||
plantlist,
|
||||
landproduct
|
||||
} from '@/api/api.js'
|
||||
import {farmLists} from "@/api/index.js"
|
||||
import {farmLists, fenceHouseData} from "@/api/index.js"
|
||||
import {farmTypeLists} from "@/api/dict.js"
|
||||
import store from "@/store/index.js"
|
||||
const showPicker = ref(false)
|
||||
const showPicker1 = ref(false)
|
||||
const showModal = ref(false)
|
||||
|
||||
|
||||
const columns1 = reactive([
|
||||
[{
|
||||
label: '施肥',
|
||||
|
@ -262,7 +264,7 @@
|
|||
|
||||
}
|
||||
})
|
||||
const dataobj = reactive({})
|
||||
const dataobj = ref({})
|
||||
const tdId = ref('')
|
||||
const palntId = ref('')
|
||||
// 绑定设备
|
||||
|
@ -306,6 +308,8 @@
|
|||
const show = ref(false)
|
||||
const showLoading = ref(false)
|
||||
const columns = reactive([]);
|
||||
const houseList = reactive([]);
|
||||
const houseInfo = ref({});
|
||||
onShow(() => {
|
||||
getlist2()
|
||||
|
||||
|
@ -363,6 +367,7 @@
|
|||
}
|
||||
|
||||
const farm_lists = ref([]);
|
||||
const house_lists = ref([]);
|
||||
const farm_types_lists = ref([]);
|
||||
const initFarmLists = ()=>{
|
||||
farmTypeLists().then(res=>{
|
||||
|
@ -378,6 +383,21 @@
|
|||
}));
|
||||
if(res.data.length>0) dataobj.value = res.data[0];
|
||||
else dataobj.value = {};
|
||||
store.commit('setFarm', dataobj.value);
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
})
|
||||
fenceHouseData().then(res=>{
|
||||
house_lists.value = res.data;
|
||||
houseList.splice(0, houseList.length, ...res.data.map((step, index) => {
|
||||
return {
|
||||
name: step.animal_name,
|
||||
id: step.id,
|
||||
};
|
||||
}));
|
||||
if(res.data.length>0) houseInfo.value = res.data[0];
|
||||
else houseInfo.value = {};
|
||||
store.commit('setHouse', houseInfo.value);
|
||||
getlist();
|
||||
}).catch(err=>{
|
||||
console.log(err);
|
||||
|
@ -385,6 +405,10 @@
|
|||
}
|
||||
initFarmLists();
|
||||
|
||||
const farm_type = computed(()=>{
|
||||
return farm_types_lists.value.find(item=>item.value==dataobj.value.farm_type)?.name || ''
|
||||
})
|
||||
|
||||
//列表获取
|
||||
const getlist = () => {
|
||||
// lindexist({
|
||||
|
@ -482,7 +506,8 @@
|
|||
const confirm = (e) => {
|
||||
// console.log(e)
|
||||
tdId.value = e.id;
|
||||
dataobj.value = farm_lists.value.find(item=>item.id==e.id);
|
||||
houseInfo.value = house_lists.value.find(item=>item.id==e.id);
|
||||
store.commit('setHouse', houseInfo.value);
|
||||
show.value = false
|
||||
showLoading.value = true
|
||||
setTimeout(() => {
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
</up-form-item>
|
||||
<up-form-item label="栏舍" prop="master_phone" borderBottom required>
|
||||
<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 label="现估重(kg)" prop="master_phone" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入现估重" type="number" border="none"
|
||||
|
@ -130,6 +130,7 @@
|
|||
const form1 = ref(null);
|
||||
const data = reactive({
|
||||
formData: {
|
||||
fence_house_id: '', //栏舍id
|
||||
title: '',
|
||||
sex: '',
|
||||
type: 1,
|
||||
|
@ -292,6 +293,10 @@
|
|||
data.formData.type = 1;
|
||||
data.formData.type_name = '购买';
|
||||
}
|
||||
if(options.id) {
|
||||
data.formData.fence_house_id = options.id;
|
||||
data.formData.fence_house_name = options.fence_house_name;
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
|
@ -6,25 +6,31 @@
|
|||
|
||||
<view class="c-title">栏舍信息</view>
|
||||
<view class="c-box">
|
||||
<up-form-item label="栏舍名称" prop="title" borderBottom required>
|
||||
<up-form-item label="栏舍名称" prop="fence_house_name" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入栏舍名称" border="none"
|
||||
v-model="data.formData.title"></up-input>
|
||||
v-model="data.formData.fence_house_name"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="动物类型" prop="title" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入动物类型" border="none"
|
||||
v-model="data.formData.title"></up-input>
|
||||
<up-form-item label="栏舍类型" prop="fence_house_type" borderBottom required @click="isshow">
|
||||
<up-input input-align="right" placeholder="请选择栏舍类型" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="fence_house_type" readonly
|
||||
style="pointer-events: none;"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="栏舍类型" prop="area" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入栏舍类型" border="none"
|
||||
v-model="data.formData.area"></up-input>
|
||||
<up-form-item label="动物名称" prop="animal_name" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入动物名称" border="none"
|
||||
v-model="data.formData.animal_name"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="容量" prop="master_name" borderBottom required>
|
||||
<up-form-item label="动物类型" prop="animal_type" borderBottom required @click="isshow1">
|
||||
<up-input input-align="right" placeholder="请选择动物类型" suffixIcon="arrow-down"
|
||||
suffix-icon-style="color: #b6b6b6;" border="none" v-model="animal_type" readonly
|
||||
style="pointer-events: none;"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="容量" prop="capacity" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入栏舍容量" border="none"
|
||||
v-model="data.formData.master_name"></up-input>
|
||||
v-model="data.formData.capacity"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="负责人" prop="master_phone" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入负责人姓名" type="number" border="none"
|
||||
v-model="data.formData.master_phone"></up-input>
|
||||
<up-form-item label="负责人" prop="master" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入负责人姓名" border="none"
|
||||
v-model="data.formData.master"></up-input>
|
||||
</up-form-item>
|
||||
<up-form-item label="负责人电话" prop="master_phone" borderBottom required>
|
||||
<up-input input-align="right" placeholder="请输入负责人电话" type="number" border="none"
|
||||
|
@ -34,15 +40,14 @@
|
|||
|
||||
|
||||
<view class="card-li">
|
||||
<view class="c-title">养殖基地图片</view>
|
||||
<view class="c-title">栏舍图片</view>
|
||||
<view class="c-box c-box-p">
|
||||
<view class="code-img1">
|
||||
<view class="" v-if="pic.length>0"
|
||||
style="display: flex;flex-direction: row;flex-wrap: wrap;margin-bottom: 30rpx;">
|
||||
<view class="" v-for="(item,i) in pic" style="margin-right: 30rpx;">
|
||||
<view class="">
|
||||
<u-icon name="close" size="15" style="margin-left:120.85rpx;"
|
||||
@click="delimg(i)"></u-icon>
|
||||
<u-icon name="close" size="15" style="margin-left:120.85rpx;" @click="delimg(i)"></u-icon>
|
||||
<u-image :src="item" width="150.85rpx" height="150.85rpx"></u-image>
|
||||
</view>
|
||||
</view>
|
||||
|
@ -64,24 +69,12 @@
|
|||
</view>
|
||||
</view>
|
||||
</up-form>
|
||||
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="columns" title="请选择"
|
||||
@close="show = false" @select="leavaType1">
|
||||
<u-action-sheet :show="show" keyName="name" closeOnClickOverlay :actions="fence_house_type_lists" title="请选择"
|
||||
@close="show = false" @select="leavaType">
|
||||
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show1" keyName="name" :actions="columns1" title="请选择" @close="show1 = false"
|
||||
@select="leavaType2">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show2" keyName="name" :actions="columns2" title="请选择" @close="show2 = false"
|
||||
@select="leavaType3">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show3" keyName="name" :actions="columns3" title="请选择" @close="show3 = false"
|
||||
@select="leavaType4">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show4" keyName="name" :actions="columns4" title="请选择" @close="show4 = false"
|
||||
@select="leavaType5">
|
||||
</u-action-sheet>
|
||||
<u-action-sheet :show="show5" keyName="name" :actions="columns5" title="请选择" @close="show5 = false"
|
||||
@select="leavaType6">
|
||||
<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>
|
||||
</view>
|
||||
|
@ -97,6 +90,13 @@
|
|||
computed,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
animalTypeLists,
|
||||
fenceHouseTypeLists
|
||||
} from "@/api/dict.js"
|
||||
import {
|
||||
fenceHouseAdd
|
||||
} from "@/api/manage.js"
|
||||
import {
|
||||
onLoad,
|
||||
onReady
|
||||
|
@ -104,85 +104,57 @@
|
|||
import {
|
||||
Uploads
|
||||
} from "@/api/upload.js"
|
||||
import {
|
||||
addland,
|
||||
province,
|
||||
city,
|
||||
county,
|
||||
towns,
|
||||
villages,
|
||||
groups
|
||||
} from '@/api/api.js'
|
||||
import store from "@/store/index.js"
|
||||
|
||||
const form1 = ref(null);
|
||||
const data = reactive({
|
||||
formData: {
|
||||
title: '',
|
||||
area: '',
|
||||
province_code: '',
|
||||
city_code: '',
|
||||
county_code: '',
|
||||
address: '',
|
||||
lat: "",
|
||||
lon: "",
|
||||
master_name: '',
|
||||
fence_house_name: '',
|
||||
fence_house_type: '',
|
||||
animal_name: '',
|
||||
animal_type: '',
|
||||
capacity: '',
|
||||
master: '',
|
||||
master_phone: '',
|
||||
pic: ['https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80',
|
||||
'https://img0.baidu.com/it/u=1717510975,3258230326&fm=253&fmt=auto?w=120&h=80'
|
||||
]
|
||||
},
|
||||
rules: {
|
||||
// name: [{
|
||||
// required: true,
|
||||
// message: '请输入姓名',
|
||||
// // 可以单个或者同时写两个触发验证方式
|
||||
// trigger: ['change', 'blur'],
|
||||
// }],
|
||||
// intro: [{
|
||||
// min: 5,
|
||||
// message: '简介不能少于5个字',
|
||||
// trigger: 'change'
|
||||
// }],
|
||||
title: [{
|
||||
fence_house_name: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写养殖基地名称',
|
||||
message: '请填写栏舍名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
area: [{
|
||||
fence_house_type: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请填写养殖基地面积',
|
||||
message: '请选择栏舍类型',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
province_code: [{
|
||||
animal_name: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请请选择所在省份',
|
||||
trigger: 'change'
|
||||
}],
|
||||
city_code: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择所在城市',
|
||||
trigger: 'change'
|
||||
}],
|
||||
county_code: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请选择所在区县',
|
||||
trigger: 'change'
|
||||
}],
|
||||
address: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入养殖基地详细地址',
|
||||
message: '请输入动物名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
master_name: [{
|
||||
animal_type: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入养殖基地负责人名称',
|
||||
message: '请输入动物类型',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
capacity: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入栏舍容量',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
master: [{
|
||||
type: 'string',
|
||||
required: true,
|
||||
message: '请输入负责人姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
master_phone: [{
|
||||
|
@ -205,59 +177,9 @@
|
|||
}
|
||||
});
|
||||
const pic = reactive([]);
|
||||
const province_name = ref(null)
|
||||
const city_name = ref(null)
|
||||
const county_name = ref(null)
|
||||
|
||||
const show = ref(false)
|
||||
const show1 = ref(false)
|
||||
const show2 = ref(false)
|
||||
const columns = reactive([])
|
||||
const columns1 = reactive([])
|
||||
const columns2 = reactive([])
|
||||
|
||||
|
||||
const provincen = () => {
|
||||
province().then((res) => {
|
||||
columns.splice(0, columns.length, ...res.data.map((step, index) => {
|
||||
return {
|
||||
name: step.province_name,
|
||||
id: step.province_code,
|
||||
};
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
const cityn = (id) => {
|
||||
|
||||
city({
|
||||
province_code: id
|
||||
}).then((res) => {
|
||||
columns1.splice(0, columns.length, ...res.data.map((step, index) => {
|
||||
return {
|
||||
name: step.city_name,
|
||||
id: step.city_code,
|
||||
};
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
const countyn = (id) => {
|
||||
county({
|
||||
city_code: id
|
||||
|
||||
}).then((res) => {
|
||||
columns2.splice(0, columns.length, ...res.data.map((step, index) => {
|
||||
return {
|
||||
name: step.county_name,
|
||||
id: step.county_code,
|
||||
|
||||
};
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//图片删除
|
||||
const delimg = (i) => {
|
||||
|
@ -299,92 +221,44 @@
|
|||
// data.formData.pic = res.data.image
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 地址 省 市 街道 乡村 小队
|
||||
|
||||
const isshow1 = () => {
|
||||
const isshow = () => {
|
||||
show.value = true
|
||||
}
|
||||
const isshow2 = () => {
|
||||
|
||||
const isshow1 = () => {
|
||||
show1.value = true
|
||||
}
|
||||
const isshow3 = () => {
|
||||
show2.value = true
|
||||
}
|
||||
const isshow4 = () => {
|
||||
show3.value = true
|
||||
}
|
||||
const isshow5 = () => {
|
||||
show4.value = true
|
||||
|
||||
}
|
||||
const isshow6 = () => {
|
||||
show5.value = true
|
||||
}
|
||||
const fence_house_type = ref('');
|
||||
const animal_type = ref('');
|
||||
|
||||
const leavaType = (e) => {
|
||||
fence_house_type.value = e.name;
|
||||
data.formData.fence_house_type = e.value;
|
||||
}
|
||||
const leavaType1 = (e) => {
|
||||
|
||||
province_name.value = e.name
|
||||
data.formData.province_code = e.id
|
||||
cityn(e.id)
|
||||
|
||||
animal_type.value = e.name;
|
||||
data.formData.animal_type = e.value;
|
||||
}
|
||||
const leavaType2 = (e) => {
|
||||
city_name.value = e.name
|
||||
data.formData.city_code = e.id
|
||||
countyn(e.id)
|
||||
}
|
||||
|
||||
const leavaType3 = (e) => {
|
||||
county_name.value = e.name
|
||||
data.formData.county_code = e.id
|
||||
|
||||
}
|
||||
const location = () => {
|
||||
|
||||
uni.showLoading({
|
||||
title: '获取位置中'
|
||||
})
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
geocode: true,
|
||||
isHighAccuracy: true,
|
||||
success: async (res) => {
|
||||
console.log(res)
|
||||
|
||||
|
||||
data.formData.lat = res.latitude
|
||||
data.formData.lon = res.longitude
|
||||
|
||||
data.formData.address = res.address.street + res
|
||||
.address.streetNum + res.address.poiName
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
console.log(data.formData)
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.hideLoading();
|
||||
console.log(err)
|
||||
console.log("erer")
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
onReady(() => {
|
||||
form1.value.setRules(data.rules);
|
||||
|
||||
});
|
||||
|
||||
const animal_type_lists = ref([]);
|
||||
const initAnimalTypeLists = ()=>{
|
||||
animalTypeLists().then(res=>{
|
||||
animal_type_lists.value = res.data;
|
||||
})
|
||||
}
|
||||
initAnimalTypeLists();
|
||||
|
||||
const fence_house_type_lists = ref([]);
|
||||
const initFenceHouseTypeLists = ()=>{
|
||||
fenceHouseTypeLists().then(res=>{
|
||||
fence_house_type_lists.value = res.data;
|
||||
})
|
||||
}
|
||||
initFenceHouseTypeLists();
|
||||
|
||||
const submit = async () => {
|
||||
try {
|
||||
|
@ -392,15 +266,13 @@
|
|||
if (valid) {
|
||||
// console.log('表单通过', data.formData);
|
||||
if (pic.length == 0) {
|
||||
|
||||
uni.$u.toast('请上传图片')
|
||||
return
|
||||
}
|
||||
data.formData.pic = JSON.stringify(pic)
|
||||
|
||||
|
||||
data.formData.farm_id = store.state.farm.id
|
||||
// 表单验证通过,执行提交操作
|
||||
addland(data.formData).then((res) => {
|
||||
fenceHouseAdd(data.formData).then((res) => {
|
||||
console.log(res)
|
||||
if (res.code == 1) {
|
||||
uni.navigateBack({
|
||||
|
@ -422,7 +294,6 @@
|
|||
|
||||
onLoad((options) => {
|
||||
|
||||
provincen()
|
||||
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -31,25 +31,25 @@
|
|||
<view class="tits">
|
||||
栏舍信息
|
||||
</view>
|
||||
<view class="card" v-for="(item,index) in datalist" :key="index" @click="navTo('/pages/plantAdmin/houseDetail?id=23')">
|
||||
<image class="img" :src="item.img"></image>
|
||||
<view class="card" v-for="(item,index) in datalist" :key="index" @click="navTo(`/pages/plantAdmin/houseDetail?id=${item.id}`)">
|
||||
<image class="img" :src="parseImg(item.pic)"></image>
|
||||
<view class="tips">
|
||||
<view class="title">{{item.name}}</view>
|
||||
<view class="title">{{item.fence_house_name}}</view>
|
||||
<view class="item">
|
||||
<view class="tip-name">动物名称: </view>
|
||||
<view>{{item.animal_name}} </view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="tip-name">动物类型: </view>
|
||||
<view>{{item.animal_type}} </view>
|
||||
<view>{{getAnimalType(item.animal_type)}} </view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="tip-name">容量: </view>
|
||||
<view>{{item.capacity}} </view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="tip-name">创建人: </view>
|
||||
<view>{{item.create_by}} </view>
|
||||
<view class="tip-name">负责人: </view>
|
||||
<view>{{item.master}} </view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="tip-name">创建时间: </view>
|
||||
|
@ -73,7 +73,7 @@
|
|||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onShow,
|
||||
|
@ -90,6 +90,13 @@
|
|||
import {
|
||||
landlist
|
||||
} from '@/api/api.js'
|
||||
import {
|
||||
fenceHouseList
|
||||
} from "@/api/manage.js"
|
||||
import {
|
||||
animalTypeLists
|
||||
} from "@/api/dict.js"
|
||||
|
||||
onLoad(() => {
|
||||
if (!store.state.userInfo) {
|
||||
uni.redirectTo({
|
||||
|
@ -98,7 +105,7 @@
|
|||
}
|
||||
})
|
||||
onShow(() => {
|
||||
// list()
|
||||
list()
|
||||
})
|
||||
onPullDownRefresh(() => {
|
||||
list()
|
||||
|
@ -107,36 +114,43 @@
|
|||
onReachBottom(() => {
|
||||
getlist()
|
||||
})
|
||||
const datalist = reactive([
|
||||
{
|
||||
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',
|
||||
}
|
||||
])
|
||||
const datalist = ref([])
|
||||
const fomData = reactive({
|
||||
page_no: 1,
|
||||
page_size: 15,
|
||||
keyword: ''
|
||||
})
|
||||
|
||||
const animal_type_lists = ref([])
|
||||
const initAnimalTypeLists = ()=>{
|
||||
animalTypeLists().then(res=>{
|
||||
animal_type_lists.value = res.data;
|
||||
})
|
||||
}
|
||||
initAnimalTypeLists();
|
||||
const getAnimalType = (type)=>{
|
||||
return animal_type_lists.value.find(item=>item.value==type)?.name||'';
|
||||
}
|
||||
|
||||
const list = () => {
|
||||
datalist.splice(0)
|
||||
datalist.value.splice(0)
|
||||
fomData.page_no = 1
|
||||
getlist()
|
||||
}
|
||||
const getlist = () => {
|
||||
// landlist(fomData).then((res) => {
|
||||
// if (res.code == 1) {
|
||||
// datalist.push(...res.data)
|
||||
// fomData.page_no = fomData.page_no + 1;
|
||||
// }
|
||||
// })
|
||||
|
||||
fenceHouseList(fomData).then(res=>{
|
||||
console.log(res);
|
||||
datalist.value = [...datalist.value, ...res.data.lists]
|
||||
console.log(datalist.value);
|
||||
})
|
||||
}
|
||||
const parseImg = (image)=>{
|
||||
try{
|
||||
if(typeof image == 'string') image = JSON.parse(image||'[]');
|
||||
return image[0];
|
||||
}catch(e){
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
//输入监听
|
||||
|
@ -151,7 +165,7 @@
|
|||
const search = () => {
|
||||
list()
|
||||
}
|
||||
const navTo = (url: string)=>{
|
||||
const navTo = (url)=>{
|
||||
if(url) uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
|
@ -379,7 +393,7 @@
|
|||
.item{
|
||||
display: flex;
|
||||
color: #999;
|
||||
font-size: 28rpx;
|
||||
font-size: 26rpx;
|
||||
.tip-name{
|
||||
flex-shrink: 0;
|
||||
color: #333;
|
||||
|
|
|
@ -144,7 +144,9 @@
|
|||
plantlist,
|
||||
landdetail
|
||||
} from '@/api/api.js'
|
||||
|
||||
import {
|
||||
fenceHouseDetail
|
||||
} from "@/api/manage.js"
|
||||
import {
|
||||
onLoad,
|
||||
onShow
|
||||
|
@ -193,23 +195,22 @@
|
|||
}]
|
||||
]);
|
||||
|
||||
|
||||
|
||||
onLoad((option) => {
|
||||
typeID.value = option.id;
|
||||
getFenceHouseDetail();
|
||||
});
|
||||
onShow(() => {
|
||||
// getlist();
|
||||
// getlist1();
|
||||
})
|
||||
|
||||
const getlist1 = () => {
|
||||
landdetail({
|
||||
land_id: typeID.value
|
||||
const getFenceHouseDetail = () => {
|
||||
fenceHouseDetail({
|
||||
id: typeID.value
|
||||
}).then((res) => {
|
||||
|
||||
if (res.code == 1) {
|
||||
Object.assign(dataobj, res.data);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -219,7 +220,6 @@
|
|||
plantlist({
|
||||
land_id: typeID.value
|
||||
}).then((res) => {
|
||||
|
||||
if (res.code == 1) {
|
||||
dataList.splice(0, dataList.length, ...res.data);
|
||||
dataList.forEach(item => {
|
||||
|
@ -255,7 +255,7 @@
|
|||
|
||||
const selectOne = (e)=>{
|
||||
if(navType.value==1){
|
||||
navTo(`/pages/plantAdmin/addBreed?name=${e.name}&type=${e.name=='购买'?1:2}`)
|
||||
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`);
|
||||
|
|
|
@ -4,20 +4,33 @@ import {
|
|||
const store = createStore({
|
||||
state: {
|
||||
userInfo:uni.getStorageSync("SY_USER")||null,
|
||||
|
||||
farm: JSON.parse(uni.getStorageSync("farm")||"{}"),
|
||||
house: JSON.parse(uni.getStorageSync("house")||"{}"),
|
||||
},
|
||||
|
||||
mutations: {
|
||||
saveUserInfo(state, info) {
|
||||
state.userInfo = info
|
||||
uni.setStorageSync("SY_USER", info)
|
||||
},
|
||||
setFarm(state, data){
|
||||
state.farm = data;
|
||||
uni.setStorageSync('farm', JSON.stringify(data));
|
||||
},
|
||||
setHouse(state, data){
|
||||
state.house = data;
|
||||
uni.setStorageSync('house', JSON.stringify(data));
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
saveUserInfo({commit}, info) {
|
||||
|
||||
commit('saveUserInfo', info)
|
||||
|
||||
commit('saveUserInfo', info);
|
||||
},
|
||||
setFarm({commit}, info){
|
||||
commit('setFarm', info)
|
||||
},
|
||||
setHouse({commit}, info){
|
||||
commit('setHouse', info)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue