fix: 新增功能修改及完善。

This commit is contained in:
tianyongbao
2025-10-16 00:29:26 +08:00
parent abe6f38f6e
commit 3377df781a
26 changed files with 3243 additions and 55 deletions

View File

@@ -47,9 +47,9 @@
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['fishery:aquUser:export']">导出</el-button>
</el-col>
</el-col> -->
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</template>
@@ -64,8 +64,13 @@
<el-table-column label="区县" align="center" prop="district" /> -->
<el-table-column label="报警电话" align="center" prop="warnPhoneJson" />
<el-table-column label="展示标题" align="center" prop="title" />
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="修改时间" align="center" prop="updateTime" />
<el-table-column label="操作" align="center" fixed="right" width="200" class-name="small-padding fixed-width">
<template #default="scope">
<el-tooltip content="查看塘口" placement="top">
<el-button link type="primary" icon="View" @click="handleViewPonds(scope.row)"></el-button>
</el-tooltip>
<el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['fishery:aquUser:edit']"></el-button>
</el-tooltip>
@@ -78,7 +83,7 @@
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card>
<!-- 添加或修改养殖用户对话框 -->
<!-- 添加或修改养殖账号对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="850px" append-to-body>
<el-form ref="aquUserFormRef" :model="form" :rules="rules" :inline="true" label-width="120px">
<el-form-item label="用户名" prop="userName">
@@ -137,12 +142,44 @@
</div>
</template>
</el-dialog>
<!-- 用户塘口信息对话框 -->
<el-dialog :title="pondDialog.title" v-model="pondDialog.visible" width="1000px" append-to-body>
<el-table :data="userPondList" border max-height="500px">
<el-table-column label="塘口名称" align="center" prop="pondName" />
<el-table-column label="鱼品种列表" align="center" prop="fishKindNames" />
<el-table-column label="面积(亩)" align="center" prop="area" />
<el-table-column label="密度(尾/亩)" align="center" prop="density" />
<el-table-column label="投苗日期" align="center" prop="placeTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.placeTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
</el-table>
<div v-if="userPondList.length === 0" class="text-center py-8 text-gray-500">
该用户暂无塘口信息
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="pondDialog.visible = false"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="AquUser" lang="ts">
import { listAquUser, getAquUser, delAquUser, addAquUser, updateAquUser } from '@/api/fishery/aquUser';
import { listPond } from '@/api/fishery/pond';
import { AquUserVO, AquUserQuery, AquUserForm } from '@/api/fishery/aquUser/types';
import { PondVO } from '@/api/fishery/pond/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -163,6 +200,14 @@ const dialog = reactive<DialogOption>({
title: ''
});
// 塘口信息相关
const pondDialog = reactive<DialogOption>({
visible: false,
title: ''
});
const userPondList = ref<PondVO[]>([]);
const currentUserId = ref<string | number>('');
const initFormData: AquUserForm = {
id: undefined,
userName: undefined,
@@ -204,7 +249,7 @@ const data = reactive<PageData<AquUserForm, AquUserQuery>>({
const { queryParams, form, rules } = toRefs(data);
/** 查询养殖用户列表 */
/** 查询养殖账号列表 */
const getList = async () => {
loading.value = true;
const res = await listAquUser(queryParams.value);
@@ -248,7 +293,7 @@ const handleSelectionChange = (selection: AquUserVO[]) => {
const handleAdd = () => {
reset();
dialog.visible = true;
dialog.title = '添加养殖用户';
dialog.title = '添加养殖账号';
};
/** 修改按钮操作 */
@@ -258,7 +303,7 @@ const handleUpdate = async (row?: AquUserVO) => {
const res = await getAquUser(_id);
Object.assign(form.value, res.data);
dialog.visible = true;
dialog.title = '修改养殖用户';
dialog.title = '修改养殖账号';
};
/** 提交按钮 */
@@ -281,7 +326,7 @@ const submitForm = () => {
/** 删除按钮操作 */
const handleDelete = async (row?: AquUserVO) => {
const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除养殖用户编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await proxy?.$modal.confirm('是否确认删除养殖账号编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
await delAquUser(_ids);
proxy?.$modal.msgSuccess('删除成功');
await getList();
@@ -298,6 +343,22 @@ const handleExport = () => {
);
};
/** 查看用户塘口信息 */
const handleViewPonds = async (row: AquUserVO) => {
currentUserId.value = row.id;
pondDialog.title = `${row.userName} 的塘口信息`;
// 根据用户ID查询塘口列表
const res = await listPond({
pageNum: 1,
pageSize: 1000,
userId: row.id
});
userPondList.value = res.rows || [];
pondDialog.visible = true;
};
onMounted(() => {
getList();
});