TraceabilityAPP/pages/records/index.vue

121 lines
2.4 KiB
Vue
Raw Normal View History

2023-10-21 18:02:06 +08:00
<template>
<view class="content">
2023-10-27 18:38:25 +08:00
<landInfo :land_id='land_id'></landInfo>
2023-10-21 18:02:06 +08:00
<view class="histroy">
<view class="tit" style="margin-bottom: 40rpx;">
历史操作记录
</view>
2023-10-28 18:28:10 +08:00
<myTable :dataList='dataList'></myTable>
2023-10-21 18:02:06 +08:00
</view>
2023-10-31 18:40:32 +08:00
<view class="btn"
@click="navgo(`/pages/growRecord/index?land_id=${land_id}&crop_id=${crop_id}&type=1&title=${title}`)">
2023-10-21 18:02:06 +08:00
记录今日操作
</view>
</view>
</template>
2023-10-23 17:57:19 +08:00
<script setup>
2023-10-25 19:55:18 +08:00
import {
2023-10-26 19:02:26 +08:00
actionsListAPI,
2023-10-28 18:28:10 +08:00
actionsDetailAPI,
2023-10-30 19:09:40 +08:00
landCropRecordListAPI,
landCropRecordInfoAPI
2023-10-25 19:55:18 +08:00
} from "@/api/plant.js"
2023-10-23 17:57:19 +08:00
import myTable from "@/components/myTable/index.vue"
2023-10-27 18:38:25 +08:00
import landInfo from "@/components/plant/landInfo.vue"
import {
onLoad
} from "@dcloudio/uni-app"
2023-10-30 19:09:40 +08:00
import {
actionsAPI
} from "@/api/animal.js"
2023-10-27 18:38:25 +08:00
import {
2023-10-28 18:28:10 +08:00
reactive,
2023-10-27 18:38:25 +08:00
ref
} from "vue"
2023-10-26 19:02:26 +08:00
// actionsListAPI({
// type: 1
// }).then(res => {
// console.log(res)
// })
2023-10-27 18:38:25 +08:00
const land_id = ref(0)
2023-10-30 19:09:40 +08:00
const crop_id = ref(0)
2023-10-28 18:28:10 +08:00
const dataList = reactive({})
2023-10-31 18:40:32 +08:00
const title = ref('')
2023-10-27 18:38:25 +08:00
onLoad((option) => {
land_id.value = option.land_id
2023-10-30 19:09:40 +08:00
crop_id.value = option.crop_id
2023-10-31 18:40:32 +08:00
title.value = option.index
2023-10-30 19:09:40 +08:00
actionsAPI({
type: 1,
crop_id: crop_id.value
2023-10-28 18:28:10 +08:00
}).then(res => {
2023-10-30 19:09:40 +08:00
// console.log(res.data[option.index].action_record)
for (let key in res.data[option.index].action_record) {
dataList[key] = res.data[option.index].action_record[key]
2023-10-28 18:28:10 +08:00
}
})
2023-10-30 19:09:40 +08:00
// landCropRecordInfoAPI({
// record_id: 41
// })
// landCropRecordListAPI({
// crop_id: 1,
// action_type_id: 1
// }).then(res => {
// for (let key in res.data) {
// dataList[key] = res.data[key]
// }
// console.log(dataList)
// })
2023-10-27 18:38:25 +08:00
})
2023-10-30 19:09:40 +08:00
// actionsDetailAPI({
// action_id: 2
// }).then(res => {
// // console.log(res)
// })
2023-10-23 17:57:19 +08:00
const navgo = (url) => {
uni.navigateTo({
url
})
}
2023-10-21 18:02:06 +08:00
</script>
<style lang="scss" scoped>
.content {
padding: 20rpx;
background-color: #F4F4F4;
min-height: 100vh;
.card {
.tit {
display: flex;
justify-content: space-between;
padding-bottom: 20rpx;
border-bottom: 1px solid #EBF1EF;
}
.card-li {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
}
}
.table {
height: 500rpx;
background-color: red;
}
.btn {
width: 371.5rpx;
height: 66.59rpx;
color: #00A15E;
border: 1px solid #00A15E;
text-align: center;
line-height: 66rpx;
border-radius: 42.06rpx 42.06rpx 42.06rpx 42.06rpx;
margin: 0 auto;
margin-top: 80rpx;
}
}
</style>