This commit is contained in:
chenbo 2024-01-10 17:56:08 +08:00
parent 00830de89a
commit ec023ecfc0
4 changed files with 99 additions and 208 deletions

View File

@ -10,96 +10,96 @@
> >
<el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules"> <el-form ref="formRef" :model="formData" label-width="120px" :rules="formRules">
<el-form-item label="设备名称" prop="name"> <el-form-item label="设备名称" prop="name">
<el-input v-model="formData.name" clearable placeholder="请输入设备名称" /> <el-input v-model="formData.name" clearable placeholder="请输入设备名称" />
</el-form-item> </el-form-item>
<el-form-item label="设备类型" prop="type"> <el-form-item label="设备类型" prop="type">
<el-select class="flex-1" v-model="formData.type" clearable placeholder="请选择设备类型"> <el-select class="flex-1" v-model="formData.type" clearable placeholder="请选择设备类型">
<el-option <el-option
v-for="(item, index) in dictData.device_type" v-for="(item, index) in dictData.device_type"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="parseInt(item.value)" :value="parseInt(item.value)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属产品" prop="product_id"> <el-form-item label="所属产品" prop="product_id">
<el-select <el-select
v-model="formData.product_id" v-model="formData.product_id"
remote remote
filterable filterable
placeholder="请输入产品信息" placeholder="请输入产品信息"
:remote-method="queryProduct" :remote-method="queryProduct"
:loading="loading" :loading="loading"
> >
<el-option <el-option
v-for="(item, index) in optionsData.product" v-for="(item, index) in optionsData.product"
:key="index" :key="index"
:label="item.productinfo" :label="item.productinfo"
:value="item.id" :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="设备编码" prop="code"> <el-form-item label="设备编码" prop="code">
<el-input v-model="formData.code" clearable placeholder="请输入设备编码" /> <el-input v-model="formData.code" clearable placeholder="请输入设备编码" />
</el-form-item> </el-form-item>
<el-form-item label="产品图" prop="image"> <el-form-item label="产品图" prop="image">
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
:accept="acceptFileTypes" :accept="acceptFileTypes"
v-model="formData.image" v-model="formData.image"
:data="{ cid: 1 }" :data="{ cid: 1 }"
:headers="{ Token: userStore.token }" :headers="{ Token: userStore.token }"
:action="action" :action="action"
:show-file-list="false" :show-file-list="false"
:on-success="handleAvatarSuccessAvatar" :on-success="handleAvatarSuccessAvatar"
> >
<img <img
v-if="formData.image" v-if="formData.image"
:src="formData.image" :src="formData.image"
class="avatar" class="avatar"
/> />
<div v-else class="avatar-uploader-icon"> <div v-else class="avatar-uploader-icon">
<el-icon> <el-icon>
<Plus /> <Plus />
</el-icon> </el-icon>
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="监测项" prop="monitor_item"> <el-form-item label="监测项" prop="monitor_item">
<el-select class="flex-1" v-model="formData.monitor_item" multiple clearable placeholder="请选择设备监测项"> <el-select class="flex-1" v-model="formData.monitor_item" multiple clearable placeholder="请选择设备监测项">
<el-option <el-option
v-for="(item, index) in dictData.monitor_item" v-for="(item, index) in dictData.monitor_item"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="视频地址" prop="video_url"> <el-form-item label="视频地址" prop="video_url">
<el-input v-model="formData.video_url" clearable placeholder="请输入视频地址" /> <el-input v-model="formData.video_url" clearable placeholder="请输入视频地址" />
</el-form-item> </el-form-item>
<el-form-item label="设备状态" prop="status"> <el-form-item label="设备状态" prop="status">
<el-select class="flex-1" v-model="formData.status" clearable placeholder="请选择设备状态"> <el-select class="flex-1" v-model="formData.status" clearable placeholder="请选择设备状态">
<el-option <el-option
v-for="(item, index) in dictData.device_status" v-for="(item, index) in dictData.device_status"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="parseInt(item.value)" :value="parseInt(item.value)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="是否在线" prop="is_online"> <el-form-item label="是否在线" prop="is_online">
<el-select class="flex-1" v-model="formData.is_online" clearable placeholder="请选择是否在线"> <el-select class="flex-1" v-model="formData.is_online" clearable placeholder="请选择是否在线">
<el-option <el-option
v-for="(item, index) in dictData.device_online_status" v-for="(item, index) in dictData.device_online_status"
:key="index" :key="index"
:label="item.name" :label="item.name"
:value="parseInt(item.value)" :value="parseInt(item.value)"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
</popup> </popup>
</div> </div>

View File

@ -2,38 +2,6 @@
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form class="mb-[-16px]" :model="queryParams" inline> <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-form-item label="产品ID" prop="product_id">
<el-input
class="w-[280px]"
v-model="queryParams.product_id"
clearable
placeholder="请输入产品ID"
/>
</el-form-item>
<el-form-item label="设备编码" prop="code">
<el-input
class="w-[280px]"
v-model="queryParams.code"
clearable
placeholder="请输入设备编码"
/>
</el-form-item>
<el-form-item label="设备名称" prop="name"> <el-form-item label="设备名称" prop="name">
<el-input <el-input
class="w-[280px]" class="w-[280px]"
@ -42,54 +10,7 @@
placeholder="请输入设备名称" placeholder="请输入设备名称"
/> />
</el-form-item> </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-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-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-form-item> <el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button> <el-button type="primary" @click="resetPage">查询</el-button>
<el-button @click="resetParams">重置</el-button> <el-button @click="resetParams">重置</el-button>
@ -130,18 +51,14 @@
prop="name" prop="name"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column label="设备类型" width="150" prop="type">
<el-table-column label="所属养殖基地" width="200">
<template #default="{ row }"> <template #default="{ row }">
<dict-value :options="dictData.device_type" :value="row.type" /> <el-tag class="mr-2" v-if="row.farm_id != null" type="info"
</template> >ID: {{ row.farm_id }}</el-tag
</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" <el-tag class="mr-2" v-if="row.farm_name != null" type="info"
>名称: {{ row.land_title }}</el-tag >名称: {{ row.farm_name }}</el-tag
> >
</template> </template>
</el-table-column> </el-table-column>
@ -266,7 +183,7 @@ if (typeof product_id == 'undefined') {
// //
const queryParams = reactive({ const queryParams = reactive({
user_id: '', user_id: '',
land_id: '', farm_id: '',
product_id: product_id, product_id: product_id,
code: '', code: '',
name: '', name: '',

View File

@ -62,12 +62,12 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="所属土地" prop="land_id"> <el-form-item label="所属养殖基地" prop="farm_id">
<el-select <el-select
v-model="formData.land_id" v-model="formData.farm_id"
remote remote
filterable filterable
placeholder="请输入土地信息" placeholder="请选择"
:remote-method="queryLand" :remote-method="queryLand"
:loading="loading" :loading="loading"
> >
@ -131,7 +131,7 @@ const formData = reactive({
id: '', id: '',
user_id: '', user_id: '',
root: 0, root: 0,
land_id: '', farm_id: '',
code: '', code: '',
name: '', name: '',
desc: '', desc: '',

View File

@ -6,35 +6,9 @@
:model="queryParams" :model="queryParams"
inline 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-form-item label="产品编号" prop="code">
<el-input class="w-[280px]" v-model="queryParams.code" clearable placeholder="请输入产品编号" />
</el-form-item>
<el-form-item label="产品名称" prop="name"> <el-form-item label="产品名称" prop="name">
<el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入产品名称" /> <el-input class="w-[280px]" v-model="queryParams.name" clearable placeholder="请输入产品名称" />
</el-form-item> </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.product_status"
:key="index"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="create_time">
<daterange-picker
v-model:startTime="queryParams.start_time"
v-model:endTime="queryParams.end_time"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="resetPage">查询</el-button> <el-button type="primary" @click="resetPage">查询</el-button>