更新种植面积

This commit is contained in:
yaooo 2023-12-07 16:01:42 +08:00
parent 51c3ff56da
commit 0d613a3a10
2 changed files with 142 additions and 80 deletions

View File

@ -1,17 +1,24 @@
<template>
<div>
<el-card class="!border-none mb-4" shadow="never">
<el-form
class="mb-[-16px]"
:model="queryParams"
inline
>
<el-form-item label="用户ID" prop="user_id">
<el-input class="w-[280px]" v-model="queryParams.user_id" clearable placeholder="请输入用户ID" />
</el-form-item>
<el-form class="mb-[-16px]" :model="queryParams" inline>
>
<el-form-item label="用户ID" prop="user_id">
<el-input
class="w-[280px]"
v-model="queryParams.user_id"
clearable
placeholder="请输入用户ID"
/>
</el-form-item>
<el-form-item label="土地ID" prop="land_id">
<el-input class="w-[280px]" v-model="queryParams.land_id" clearable placeholder="请输入土地ID" />
</el-form-item>
<el-input
class="w-[280px]"
v-model="queryParams.land_id"
clearable
placeholder="请输入土地ID"
/>
</el-form-item>
<el-form-item label="产品ID" prop="product_id">
<el-input
class="w-[280px]"
@ -19,46 +26,71 @@
clearable
placeholder="请输入产品ID"
/>
</el-form-item>
</el-form-item>
<el-form-item label="设备编码" prop="code">
<el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入设备编码" />
</el-form-item>
<el-input
class="w-[280px]"
v-model="queryParams.code"
clearable
placeholder="请输入设备编码"
/>
</el-form-item>
<el-form-item label="设备名称" prop="name">
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入设备名称" />
</el-form-item>
<el-input
class="w-[280px]"
v-model="queryParams.name"
clearable
placeholder="请输入设备名称"
/>
</el-form-item>
<el-form-item label="设备类型" prop="type">
<el-select class="w-[280px]" v-model="queryParams.type" clearable placeholder="请选择设备类型">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.device_type"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-select
class="w-[280px]"
v-model="queryParams.type"
clearable
placeholder="请选择设备类型"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.device_type"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="设备状态" prop="status">
<el-select class="w-[280px]" v-model="queryParams.status" clearable placeholder="请选择设备状态">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.device_status"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-select
class="w-[280px]"
v-model="queryParams.status"
clearable
placeholder="请选择设备状态"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.device_status"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否在线" prop="is_online">
<el-select class="w-[280px]" v-model="queryParams.is_online" clearable placeholder="请选择是否在线">
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.device_online_status"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-select
class="w-[280px]"
v-model="queryParams.is_online"
clearable
placeholder="请选择是否在线"
>
<el-option label="全部" value=""></el-option>
<el-option
v-for="(item, index) in dictData.device_online_status"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button>
@ -80,7 +112,11 @@
删除
</el-button>
<div class="mt-4">
<el-table :data="pager.lists" @selection-change="handleSelectionChange" style="width: 100%">
<el-table
:data="pager.lists"
@selection-change="handleSelectionChange"
style="width: 100%"
>
<el-table-column type="selection" width="55" />
<el-table-column label="ID" prop="id" width="80" show-overflow-tooltip />
<!-- <el-table-column label="用户信息" width="200">
@ -89,7 +125,12 @@
<el-tag class="mr-2" type="info">账户: {{ row.account }}</el-tag>
</template>
</el-table-column> -->
<el-table-column label="设备名称" width="200" prop="name" show-overflow-tooltip />
<el-table-column
label="设备名称"
width="200"
prop="name"
show-overflow-tooltip
/>
<el-table-column label="设备类型" width="150" prop="type">
<template #default="{ row }">
<dict-value :options="dictData.device_type" :value="row.type" />
@ -97,32 +138,52 @@
</el-table-column>
<el-table-column label="所属土地" width="200">
<template #default="{ row }">
<el-tag class="mr-2" v-if="row.land_id != null" type="info">ID: {{ row.land_id }}</el-tag>
<el-tag class="mr-2" v-if="row.land_title != null" type="info">名称: {{ row.land_title }}</el-tag>
<el-tag class="mr-2" v-if="row.land_id != null" type="info"
>ID: {{ row.land_id }}</el-tag
>
<el-tag class="mr-2" v-if="row.land_title != null" type="info"
>名称: {{ row.land_title }}</el-tag
>
</template>
</el-table-column>
<el-table-column label="所属产品" width="200">
<template #default="{ row }">
<el-tag class="mr-2" v-if="row.product_id != null" type="info">ID: {{ row.product_id }}</el-tag>
<el-tag class="mr-2" v-if="row.product_name != null" type="info">名称: {{ row.product_name }}</el-tag>
<el-tag class="mr-2" v-if="row.product_id != null" type="info"
>ID: {{ row.product_id }}</el-tag
>
<el-tag class="mr-2" v-if="row.product_name != null" type="info"
>名称: {{ row.product_name }}</el-tag
>
</template>
</el-table-column>
<el-table-column label="设备编码" width="120" prop="code" show-overflow-tooltip />
<el-table-column
label="设备编码"
width="120"
prop="code"
show-overflow-tooltip
/>
<el-table-column label="设备状态" width="100" align="center" prop="status">
<template #default="{ row }">
<dict-value :options="dictData.device_status" :value="row.status" />
</template>
</el-table-column>
<template #default="{ row }">
<dict-value :options="dictData.device_status" :value="row.status" />
</template>
</el-table-column>
<el-table-column label="是否在线" width="100" align="center" prop="is_online">
<template #default="{ row }">
<dict-value :options="dictData.device_online_status" :value="row.is_online" />
</template>
</el-table-column>
<el-table-column label="创建时间" width="160" align="center" prop="create_time">
<template #default="{ row }">
<span>{{ row.create_time ? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss') : '' }}</span>
</template>
</el-table-column>
<template #default="{ row }">
<dict-value
:options="dictData.device_online_status"
:value="row.is_online"
/>
</template>
</el-table-column>
<el-table-column label="创建时间" width="160" align="center" prop="create_time">
<template #default="{ row }">
<span>{{
row.create_time
? timeFormat(row.create_time, 'yyyy-mm-dd hh:MM:ss')
: ''
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="260" align="center" fixed="right">
<template #default="{ row }">
<el-button
@ -133,11 +194,7 @@
>
编辑
</el-button>
<el-button
v-perms="['device.device/detail']"
type="primary"
link
>
<el-button v-perms="['device.device/detail']" type="primary" link>
<router-link
:to="{
path: getRoutePath('device.device/detail'),
@ -146,14 +203,10 @@
}
}"
>
详情
详情
</router-link>
</el-button>
<el-button
v-perms="['device.monitor_alarm/lists']"
type="primary"
link
>
<el-button v-perms="['device.monitor_alarm/lists']" type="primary" link>
<router-link
:to="{
path: getRoutePath('device.monitor_alarm/lists'),
@ -162,7 +215,7 @@
}
}"
>
报警
报警
</router-link>
</el-button>
<el-button
@ -181,7 +234,13 @@
<pagination v-model="pager" @change="getLists" />
</div>
</el-card>
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" />
<edit-popup
v-if="showEdit"
ref="editRef"
:dict-data="dictData"
@success="getLists"
@close="showEdit = false"
/>
</div>
</template>
@ -225,7 +284,9 @@ const handleSelectionChange = (val: any[]) => {
}
//
const { dictData } = useDictData('device_type,device_status,device_online_status,device_bind_status,monitor_item')
const { dictData } = useDictData(
'device_type,device_status,device_online_status,device_bind_status,monitor_item'
)
//
const { pager, getLists, resetParams, resetPage } = usePaging({
@ -257,4 +318,3 @@ const handleDelete = async (id: number | any[]) => {
getLists()
</script>

View File

@ -112,6 +112,8 @@ class LandPlantLogic extends BaseLogic
*/
public static function delete(array $params): bool
{
$landPlant = LandPlant::findOrEmpty($params['id'])->toArray();
Land::where('id', $landPlant['land_id'])->inc('score', $landPlant['area'])->update();
Db::name('land_plant_action')->where('plant_id', $params['id'])->delete();
return LandPlant::destroy($params['id']);
}