更新图片展示

This commit is contained in:
yaooo 2023-11-28 11:18:56 +08:00
parent 9f8ee351ed
commit 7eec3bb829
11 changed files with 74 additions and 23 deletions

View File

@ -83,6 +83,9 @@
</el-form-item>
<el-form-item label="负责人电话" prop="master_phone">
<el-input v-model="formData.master_phone" clearable placeholder="请输入负责人电话" />
</el-form-item>
<el-form-item label="土地图片" prop="pic">
<material-picker v-model="formData.pic" :limit="4" />
</el-form-item>
</el-form>
</popup>
@ -134,6 +137,7 @@ const formData = reactive({
latitude: '',
master_name: '',
master_phone: '',
pic: ''
})
//
@ -167,10 +171,11 @@ const setFormData = async (data: Record<any, any>) => {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
if (key == 'pic') {
formData[key] = ''
}
}
}
}
const getDetail = async (row: Record<string, any>) => {

View File

@ -45,16 +45,20 @@
<el-table-column label="ID" prop="id" width="80" show-overflow-tooltip />
<el-table-column label="用户信息" width="200">
<template #default="{ row }">
<el-tag class="ml-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="ml-2" type="success">账户: {{ row.user.account }}</el-tag>
<el-tag class="mr-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="mr-2" type="success">账户: {{ row.user.account }}</el-tag>
</template>
</el-table-column>
<el-table-column label="土地名称">
<template #default="{ row }">
<el-tag class="mr-2" type="success">{{ row.title }}</el-tag>
</template>
</el-table-column>
<el-table-column label="土地名称" prop="title" show-overflow-tooltip />
<el-table-column label="土地面积" prop="total_area" show-overflow-tooltip />
<el-table-column label="剩余面积" prop="residual_area" show-overflow-tooltip />
<el-table-column label="土地负责人" prop="master_name" show-overflow-tooltip />
<el-table-column label="负责人电话" prop="master_phone" show-overflow-tooltip />
<el-table-column label="操作" width="280" align="center" fixed="right">
<el-table-column label="操作" width="350" align="center" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['land.land/edit']"
@ -64,6 +68,10 @@
>
编辑
</el-button>
<el-button type="primary" link @click="handleDetail(row)"
>
土地图片
</el-button>
<el-button
v-perms="['land.land_plant/lists']"
type="primary"
@ -114,6 +122,22 @@
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
</div>
<el-dialog v-model="dialogPicVisible" title="土地图片" center>
<div style="display: inline-block; margin: 12px" v-for="img in detailData.picData" :key="img">
<el-image
style="width: 200px; height: 200px"
:src="img"
:zoom-rate="1.2"
:max-scale="5"
:min-scale="0.2"
:preview-src-list="detailData.picData"
:initial-index="4"
fit="cover"
center
/>
</div>
</el-dialog>
</template>
<script lang="ts" setup name="landLists">
@ -160,6 +184,22 @@ const { pager, getLists, resetParams, resetPage } = usePaging({
params: queryParams
})
const dialogPicVisible = ref(false)
const detailData = reactive({
picData: [] as any[]
})
//
const handleDetail = (data: any) => {
detailData.picData = []
const picList = JSON.parse(data.pic)
for (const key in picList) {
detailData.picData.unshift(picList[key])
}
console.log(detailData.picData)
dialogPicVisible.value = true
}
//
const handleAdd = async () => {
showEdit.value = true

View File

@ -72,7 +72,7 @@
</el-select>
</el-form-item>
<el-form-item label="种植图片" prop="pic">
<material-picker :limit="4" />
<material-picker v-model="formData.pic" :limit="4" />
</el-form-item>
<el-form-item label="播种时间" prop="plant_date">
<el-date-picker
@ -126,7 +126,7 @@ const formData = reactive({
status: '',
pic: '',
qr_code: '',
plant_date: '',
plant_date: ''
})
@ -176,6 +176,9 @@ const setFormData = async (data: Record<any, any>) => {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
if (key == 'pic') {
formData[key] = ''
}
}
}

View File

@ -52,14 +52,14 @@
<el-table-column label="ID" prop="id" width="80" show-overflow-tooltip />
<el-table-column label="用户信息" width="200">
<template #default="{ row }">
<el-tag class="ml-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="ml-2" type="success">账户: {{ row.account }}</el-tag>
<el-tag class="mr-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="mr-2" type="success">账户: {{ row.account }}</el-tag>
</template>
</el-table-column>
<el-table-column label="土地信息" width="200">
<template #default="{ row }">
<el-tag class="ml-2" type="success">ID: {{ row.land_id }}</el-tag>
<el-tag class="ml-2" type="success">名称: {{ row.title }}</el-tag>
<el-tag class="mr-2" type="success">ID: {{ row.land_id }}</el-tag>
<el-tag class="mr-2" type="success">名称: {{ row.title }}</el-tag>
</template>
</el-table-column>
<el-table-column label="种植种类" prop="kind" show-overflow-tooltip />

View File

@ -42,14 +42,14 @@
<el-table-column label="ID" prop="id" width="80" show-overflow-tooltip />
<el-table-column label="用户信息" width="200">
<template #default="{ row }">
<el-tag class="ml-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="ml-2" type="success">账户: {{ row.account }}</el-tag>
<el-tag class="mr-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="mr-2" type="success">账户: {{ row.account }}</el-tag>
</template>
</el-table-column>
<el-table-column label="土地种植信息" width="200">
<template #default="{ row }">
<el-tag class="ml-2" type="success">ID: {{ row.plant_id }}</el-tag>
<el-tag class="ml-2" type="success">类型: {{ row.kind }} 品牌: {{ row.breed }}</el-tag>
<el-tag class="mr-2" type="success">ID: {{ row.plant_id }}</el-tag>
<el-tag class="mr-2" type="success">类型: {{ row.kind }} 品牌: {{ row.breed }}</el-tag>
</template>
</el-table-column>
<el-table-column label="种植操作类型" prop="type">

View File

@ -50,7 +50,7 @@
/>
<el-table-column label="部门状态" prop="status" min-width="100">
<template #default="{ row }">
<el-tag class="ml-2" :type="row.status ? '' : 'danger'">{{
<el-tag class="mr-2" :type="row.status ? '' : 'danger'">{{
row.status_desc
}}</el-tag>
</template>

View File

@ -54,7 +54,7 @@
<el-table-column label="添加时间" prop="create_time" min-width="180" />
<el-table-column label="状态" prop="status" min-width="100">
<template #default="{ row }">
<el-tag class="ml-2" :type="row.status ? '' : 'danger'">
<el-tag class="mr-2" :type="row.status ? '' : 'danger'">
{{ row.status_desc }}
</el-tag>
</template>

View File

@ -62,14 +62,14 @@
<el-table-column label="ID" prop="id" width="80" show-overflow-tooltip />
<el-table-column label="用户信息" width="200">
<template #default="{ row }">
<el-tag class="ml-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="ml-2" type="success">账户: {{ row.account }}</el-tag>
<el-tag class="mr-2" type="success">ID: {{ row.user_id }}</el-tag>
<el-tag class="mr-2" type="success">账户: {{ row.account }}</el-tag>
</template>
</el-table-column>
<el-table-column label="土地信息" width="200">
<template #default="{ row }">
<el-tag class="ml-2" type="success">ID: {{ row.land_id }}</el-tag>
<el-tag class="ml-2" type="success">名称: {{ row.title }}</el-tag>
<el-tag class="mr-2" type="success">ID: {{ row.land_id }}</el-tag>
<el-tag class="mr-2" type="success">名称: {{ row.title }}</el-tag>
</template>
</el-table-column>
<el-table-column label="产品编号" prop="code" show-overflow-tooltip />

View File

@ -69,7 +69,7 @@ class LandLists extends BaseAdminDataLists implements ListsSearchInterface
public function lists(): array
{
return Land::where($this->searchWhere)->where($this->userSearch())->with('user')
->field(['id', 'user_id', 'title', 'total_area', 'residual_area', 'province_code', 'province_name', 'city_code', 'city_name', 'county_code', 'county_name', 'town_code', 'town_name', 'village_code', 'village_name', 'group_code', 'group_name', 'longitude', 'latitude', 'master_name', 'master_phone'])
->field(['id', 'user_id', 'title', 'total_area', 'residual_area', 'province_code', 'province_name', 'city_code', 'city_name', 'county_code', 'county_name', 'town_code', 'town_name', 'village_code', 'village_name', 'group_code', 'group_name', 'longitude', 'latitude', 'master_name', 'master_phone', 'pic'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()

View File

@ -61,6 +61,7 @@ class LandLogic extends BaseLogic
'latitude' => $params['latitude'],
'master_name' => $params['master_name'],
'master_phone' => $params['master_phone'],
'pic' => json_encode($params['pic']),
]);
Db::commit();
@ -105,6 +106,7 @@ class LandLogic extends BaseLogic
'latitude' => $params['latitude'],
'master_name' => $params['master_name'],
'master_phone' => $params['master_phone'],
'pic' => json_encode($params['pic']),
]);
Db::commit();

View File

@ -82,6 +82,7 @@ class LandValidate extends BaseValidate
'master_name' => '土地负责人',
'master_phone' => '负责人电话',
'status' => '土地状态1-未种植 2-部分种植 3-全部种植',
'pic' => '土地图片',
];