更新溯源信息
This commit is contained in:
parent
02e53460d7
commit
6c9a60aa88
|
@ -33,4 +33,9 @@ export function apiLandPlantDelete(params: any) {
|
|||
// 土地种植表详情
|
||||
export function apiLandPlantDetail(params: any) {
|
||||
return request.get({ url: '/land.land_plant/detail', params })
|
||||
}
|
||||
|
||||
// 种植溯源信息
|
||||
export function apiSuyuanDetail(params: any) {
|
||||
return request.get({ url: '/land.land_plant/suyuan', params })
|
||||
}
|
|
@ -12,37 +12,37 @@
|
|||
<div class="flex flex-wrap">
|
||||
<div v-if="deviceData.device.land_id != ''" class="w-1/2 md:w-1/3 mb-4">
|
||||
<div class="leading-10">所属土地:</div>
|
||||
<div class="text-3xl text-tx-secondary">ID:{{ deviceData.device.land_id }} / 名称:{{ deviceData.device.land_title }}</div>
|
||||
<div class="text-3xl text-tx-gray">ID:{{ deviceData.device.land_id }} / 名称:{{ deviceData.device.land_title }}</div>
|
||||
</div>
|
||||
<div v-if="deviceData.device.product_id != ''" class="w-1/2 md:w-1/3 mb-4">
|
||||
<div class="leading-10">所属产品:</div>
|
||||
<div class="text-3xl text-tx-secondary">ID:{{ deviceData.device.product_id }} / 名称:{{ deviceData.device.land_title }}</div>
|
||||
<div class="text-3xl text-tx-gray">ID:{{ deviceData.device.product_id }} / 名称:{{ deviceData.device.land_title }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-wrap">
|
||||
<div class="w-1/2 md:w-1/6 mb-4">
|
||||
<div class="leading-10">设备名称:</div>
|
||||
<div class="text-3xl text-tx-secondary">{{ deviceData.device.name }}</div>
|
||||
<div class="text-3xl text-tx-gray">{{ deviceData.device.name }}</div>
|
||||
</div>
|
||||
<div class="w-1/2 md:w-1/6 mb-4">
|
||||
<div class="leading-10">设备编码:</div>
|
||||
<div class="text-3xl text-tx-secondary">{{ deviceData.device.code }}</div>
|
||||
<div class="text-3xl text-tx-gray">{{ deviceData.device.code }}</div>
|
||||
</div>
|
||||
<div class="w-1/2 md:w-1/6 mb-4">
|
||||
<div class="leading-10">设备类型:</div>
|
||||
<div class="text-3xl text-tx-secondary">
|
||||
<div class="text-3xl text-tx-gray">
|
||||
<dict-value :options="dictData.device_type" :value="deviceData.device.type" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-1/2 md:w-1/6 mb-4">
|
||||
<div class="leading-10">设备状态:</div>
|
||||
<div class="text-3xl text-tx-secondary">
|
||||
<div class="text-3xl text-tx-gray">
|
||||
<dict-value :options="dictData.device_status" :value="deviceData.device.status" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-1/2 md:w-1/6 mb-4">
|
||||
<div class="leading-10">是否在线:</div>
|
||||
<div class="text-3xl text-tx-secondary">
|
||||
<div class="text-3xl text-tx-gray">
|
||||
<dict-value :options="dictData.device_online_status" :value="deviceData.device.is_online" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -104,18 +104,21 @@
|
|||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
v-perms="['land.land_plant/edit']"
|
||||
v-perms="['land.land_plant/suyuan']"
|
||||
type="primary"
|
||||
link
|
||||
@click="handleEdit(row)"
|
||||
@click="handleSuyuan(row)"
|
||||
>
|
||||
溯源信息
|
||||
</el-button>
|
||||
<el-button type="primary" link @click="handleDetail(row)"
|
||||
>
|
||||
<el-button type="primary" link @click="handleDetail(row)">
|
||||
种植图片
|
||||
</el-button>
|
||||
<el-button v-perms="['land.land_plant_action/lists']" type="primary" link >
|
||||
<el-button
|
||||
v-perms="['land.land_plant_action/lists']"
|
||||
type="primary"
|
||||
link
|
||||
>
|
||||
<router-link
|
||||
:to="{
|
||||
path: getRoutePath('land.land_plant_action/lists'),
|
||||
|
@ -161,13 +164,53 @@
|
|||
/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="dialogSuyuanVisible" title="溯源信息">
|
||||
<div class="overflow-y-auto" style="height: 500px">
|
||||
<el-carousel indicator-position="outside">
|
||||
<el-carousel-item v-for="(value, index) in suyuanData.categoryData.pic" :key="index" class="text-center">
|
||||
<el-image
|
||||
style="width: auto; height: 100%"
|
||||
:src="suyuanData.categoryData.pic[index]"
|
||||
/>
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
<el-tag size="large" type="info">品类信息</el-tag>
|
||||
<el-card class="box-card mb-4">
|
||||
<div class="mb-2 text-2xl text-tx-gray">
|
||||
商品名称:{{ suyuanData.categoryData.kind }}
|
||||
</div>
|
||||
<div class="mb-2 text-2xl text-tx-gray">
|
||||
收获日期:{{ suyuanData.categoryData.harvest_date }} 天
|
||||
</div>
|
||||
<div class="mb-2 text-2xl text-tx-gray">
|
||||
生长周期:{{ suyuanData.categoryData.group_day }}
|
||||
</div>
|
||||
<div class="mb-2 text-2xl text-tx-gray">
|
||||
生产地址:{{ suyuanData.categoryData.land_address }}
|
||||
</div>
|
||||
</el-card>
|
||||
<div v-for="(value, index) in suyuanData.landActionType" :key="index">
|
||||
<el-tag size="large" type="info">{{ suyuanData.landActionType[index] }}</el-tag>
|
||||
<el-card class="box-card mb-4">
|
||||
<div
|
||||
v-for="(data, item) in suyuanData.landActionData[index]"
|
||||
:key="item"
|
||||
class="mb-2 text-2xl text-tx-gray"
|
||||
>
|
||||
{{ data.item ?? '' }}:{{ data.value ?? '' }}
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="landPlantLists">
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { getRoutePath } from '@/router'
|
||||
import { useDictData } from '@/hooks/useDictOptions'
|
||||
import { apiLandPlantLists, apiLandPlantDelete } from '@/api/land_plant'
|
||||
import { apiLandPlantLists, apiLandPlantDelete, apiSuyuanDetail } from '@/api/land_plant'
|
||||
import { timeFormat } from '@/utils/util'
|
||||
import feedback from '@/utils/feedback'
|
||||
import EditPopup from './edit.vue'
|
||||
|
@ -213,6 +256,7 @@ const { pager, getLists, resetParams, resetPage } = usePaging({
|
|||
})
|
||||
|
||||
const dialogPicVisible = ref(false)
|
||||
const dialogSuyuanVisible = ref(false)
|
||||
const detailData = reactive({
|
||||
picData: [] as any[]
|
||||
})
|
||||
|
@ -224,10 +268,123 @@ const handleDetail = (data: any) => {
|
|||
for (const key in picList) {
|
||||
detailData.picData.unshift(picList[key])
|
||||
}
|
||||
console.log(detailData.picData)
|
||||
dialogPicVisible.value = true
|
||||
}
|
||||
|
||||
|
||||
interface actionData {
|
||||
[key: string]: any
|
||||
}
|
||||
|
||||
const actionMap = reactive<actionData>({
|
||||
'1': {
|
||||
kind: '肥料种类',
|
||||
breed: '肥料品牌',
|
||||
dosage: '肥料用量',
|
||||
start_date: '开始日期',
|
||||
end_date: '结束日期',
|
||||
area: '施肥面积',
|
||||
user: '参与人',
|
||||
pic: '施肥图片',
|
||||
remark: '备注信息'
|
||||
},
|
||||
'2': {
|
||||
kind: '除草剂种类',
|
||||
breed: '除草剂品牌',
|
||||
dosage: '除草剂用量',
|
||||
start_date: '开始日期',
|
||||
end_date: '结束日期',
|
||||
area: '作业面积',
|
||||
user: '参与人',
|
||||
pic: '除草图片',
|
||||
remark: '备注信息'
|
||||
},
|
||||
'3': {
|
||||
type: '灌溉类型',
|
||||
start_date: '开始日期',
|
||||
end_date: '结束日期',
|
||||
area: '灌溉面积',
|
||||
user: '参与人',
|
||||
pic: '灌溉图片',
|
||||
remark: '备注信息'
|
||||
},
|
||||
'4': {
|
||||
type: '杀虫剂种类',
|
||||
breed: '杀虫剂品牌',
|
||||
dosage: '杀虫剂用量',
|
||||
start_date: '开始日期',
|
||||
end_date: '结束日期',
|
||||
area: '作业面积',
|
||||
user: '参与人',
|
||||
pic: '杀虫图片',
|
||||
remark: '备注信息'
|
||||
},
|
||||
'5': {
|
||||
user: '参与人',
|
||||
pic: '收获图片',
|
||||
remark: '备注信息'
|
||||
}
|
||||
})
|
||||
|
||||
const landActionData = reactive({
|
||||
gridData: [{}]
|
||||
})
|
||||
|
||||
const suyuanData = reactive({
|
||||
categoryData: {
|
||||
kind: '',
|
||||
group_day: '',
|
||||
harvest_date: '',
|
||||
land_address: '',
|
||||
pic: ''
|
||||
},
|
||||
landActionType: [''],
|
||||
landActionData: [reactive<actionData>({})]
|
||||
})
|
||||
|
||||
// 溯源详情
|
||||
const handleSuyuan = (data: any) => {
|
||||
detailData.picData = []
|
||||
apiSuyuanDetail({
|
||||
id: data.id
|
||||
})
|
||||
.then((res: any) => {
|
||||
dialogSuyuanVisible.value = true
|
||||
console.log(res)
|
||||
suyuanData.categoryData.kind = res.kind ?? ''
|
||||
suyuanData.categoryData.group_day = res.group_day ?? ''
|
||||
suyuanData.categoryData.harvest_date = res.harvest_date ?? ''
|
||||
suyuanData.categoryData.land_address = res.land_address ?? ''
|
||||
suyuanData.categoryData.pic = res.pic ?? []
|
||||
landActionData.gridData = [{}]
|
||||
for (const key in res.actions) {
|
||||
landActionData.gridData = [{}]
|
||||
const type = res.actions[key]['type']
|
||||
const typeText = res.actions[key]['type_text'] as string
|
||||
const detail = res.actions[key]['detail']
|
||||
for (const key in actionMap[type]) {
|
||||
const item = actionMap[type][key] ?? '-'
|
||||
for (const dkey in detail) {
|
||||
if (dkey == key) {
|
||||
landActionData.gridData.push({
|
||||
item: item,
|
||||
value: detail[key] ?? '-'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
landActionData.gridData.splice(0, 1)
|
||||
suyuanData.landActionType.push(typeText)
|
||||
suyuanData.landActionData.push(landActionData.gridData)
|
||||
}
|
||||
suyuanData.landActionType.splice(0, 1)
|
||||
suyuanData.landActionData.splice(0, 1)
|
||||
})
|
||||
.catch((err: any) => {
|
||||
console.log('err', err)
|
||||
})
|
||||
}
|
||||
|
||||
// 添加
|
||||
const handleAdd = async () => {
|
||||
showEdit.value = true
|
||||
|
|
|
@ -217,6 +217,7 @@ const handleDetail = (data: any) => {
|
|||
value: action[key] ?? '-'
|
||||
})
|
||||
}
|
||||
detailData.gridData.splice(0, 1)
|
||||
dialogTableVisible.value = true
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="create_time">
|
||||
<el-form-item label="报警时间" prop="create_time">
|
||||
<daterange-picker
|
||||
v-model:startTime="queryParams.start_time"
|
||||
v-model:endTime="queryParams.end_time"
|
||||
|
|
Loading…
Reference in New Issue