feat(路径信息): 优化路径信息页面布局并添加路径明细功能

- 移除创建时间查询条件,简化搜索表单
- 调整表格列宽,添加序号列并显示创建人/更新人
- 重构对话框为标签页形式,新增路径明细管理功能
- 默认设置是否标识为1(是)
- 优化表单校验规则,路径编号设为必填项
main
zch 2 months ago
parent d238ef5c25
commit a24eabc00e

@ -10,19 +10,11 @@
<el-form-item label="路径名称" prop="pathName"> <el-form-item label="路径名称" prop="pathName">
<el-input v-model="queryParams.pathName" placeholder="请输入路径名称" clearable @keyup.enter="handleQuery" /> <el-input v-model="queryParams.pathName" placeholder="请输入路径名称" clearable @keyup.enter="handleQuery" />
</el-form-item> </el-form-item>
<el-form-item label="是否标识1-是0-否" prop="isFlag"> <el-form-item label="是否标识" prop="isFlag">
<el-select v-model="queryParams.isFlag" placeholder="请选择是否标识1-是0-否" clearable > <el-select v-model="queryParams.isFlag" placeholder="请选择是否标识" clearable>
<el-option v-for="dict in wcs_is_flag" :key="dict.value" :label="dict.label" :value="dict.value"/> <el-option v-for="dict in wcs_is_flag" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="创建时间" prop="createdTime">
<el-date-picker clearable
v-model="queryParams.createdTime"
type="date"
value-format="YYYY-MM-DD"
placeholder="请选择创建时间"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button> <el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button> <el-button icon="Refresh" @click="resetQuery"></el-button>
@ -53,21 +45,23 @@
<el-table v-loading="loading" border :data="pathInfoList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" border :data="pathInfoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键标识" align="center" prop="objId" v-if="true" /> <el-table-column label="序号" align="center" type="index" width="60" />
<el-table-column label="路径编号" align="center" prop="pathCode" /> <el-table-column label="路径编号" align="center" prop="pathCode" />
<el-table-column label="路径名称" align="center" prop="pathName" /> <el-table-column label="路径名称" align="center" prop="pathName" />
<el-table-column label="是否标识1-是0-否" align="center" prop="isFlag"> <el-table-column label="是否标识" align="center" prop="isFlag">
<template #default="scope"> <template #default="scope">
<dict-tag :options="wcs_is_flag" :value="scope.row.isFlag"/> <dict-tag :options="wcs_is_flag" :value="scope.row.isFlag"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createdTime" width="180"> <el-table-column label="创建时间" align="center" prop="createdTime" width="100">
<template #default="scope"> <template #default="scope">
<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width"> <el-table-column label="创建人" align="center" prop="createdByName" width="100" />
<el-table-column label="更新人" align="center" prop="updatedByName" width="100" />
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="120">
<template #default="scope"> <template #default="scope">
<el-tooltip content="修改" placement="top"> <el-tooltip content="修改" placement="top">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['wcs:pathInfo:edit']"></el-button> <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['wcs:pathInfo:edit']"></el-button>
@ -81,36 +75,66 @@
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card> </el-card>
<!-- 添加或修改路径信息对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body> <!-- 添加或修改路径信息 -->
<el-form ref="pathInfoFormRef" :model="form" :rules="rules" label-width="80px"> <el-dialog :title="dialog.title" v-model="dialog.visible" width="800px" append-to-body>
<el-form-item label="路径编号" prop="pathCode"> <el-tabs v-model="activeTab">
<el-input v-model="form.pathCode" placeholder="请输入路径编号" /> <el-tab-pane label="基本信息" name="basic">
</el-form-item> <el-form ref="pathInfoFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="路径名称" prop="pathName"> <el-row :gutter="16">
<el-input v-model="form.pathName" placeholder="请输入路径名称" /> <el-col :span="12">
</el-form-item> <el-form-item label="路径编号" prop="pathCode">
<el-form-item label="是否标识1-是0-否" prop="isFlag"> <el-input v-model="form.pathCode" placeholder="请输入路径编号" />
<el-radio-group v-model="form.isFlag"> </el-form-item>
<el-radio </el-col>
v-for="dict in wcs_is_flag" <el-col :span="12">
:key="dict.value" <el-form-item label="路径名称" prop="pathName">
:value="parseInt(dict.value)" <el-input v-model="form.pathName" placeholder="请输入路径名称" />
>{{dict.label}}</el-radio> </el-form-item>
</el-radio-group> </el-col>
</el-form-item> <el-col :span="12">
<el-form-item label="备注" prop="remark"> <el-form-item label="是否标识" prop="isFlag">
<el-input v-model="form.remark" placeholder="请输入备注" /> <el-radio-group v-model="form.isFlag">
</el-form-item> <el-radio v-for="dict in wcs_is_flag" :key="dict.value" :value="parseInt(dict.value)">{{ dict.label }}</el-radio>
<el-form-item label="创建时间" prop="createdTime"> </el-radio-group>
<el-date-picker clearable </el-form-item>
v-model="form.createdTime" </el-col>
type="datetime" <el-col :span="24">
value-format="YYYY-MM-DD HH:mm:ss" <el-form-item label="备注" prop="remark">
placeholder="请选择创建时间"> <el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-date-picker> </el-form-item>
</el-form-item> </el-col>
</el-form> </el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="路径明细" name="detail">
<div class="mb-2">
<el-button type="primary" size="small" icon="Plus" @click="handleAddDetail"></el-button>
</div>
<el-table border :data="detailList" size="small">
<el-table-column label="起点" align="center" prop="startPoint">
<template #default="scope">
<el-input v-model="scope.row.startPoint" placeholder="起点" size="small" />
</template>
</el-table-column>
<el-table-column label="终点" align="center" prop="endPoint">
<template #default="scope">
<el-input v-model="scope.row.endPoint" placeholder="终点" size="small" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark">
<template #default="scope">
<el-input v-model="scope.row.remark" placeholder="备注" size="small" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="80">
<template #default="scope">
<el-button link type="danger" icon="Delete" size="small" @click="handleDelDetail(scope.$index)"></el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button> <el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
@ -124,14 +148,17 @@
<script setup name="PathInfo" lang="ts"> <script setup name="PathInfo" lang="ts">
import { listPathInfo, getPathInfo, delPathInfo, addPathInfo, updatePathInfo } from '@/api/wcs/pathInfo'; import { listPathInfo, getPathInfo, delPathInfo, addPathInfo, updatePathInfo } from '@/api/wcs/pathInfo';
import { PathInfoVO, PathInfoQuery, PathInfoForm } from '@/api/wcs/pathInfo/types'; import { PathInfoVO, PathInfoQuery, PathInfoForm } from '@/api/wcs/pathInfo/types';
import { PathDetailsVO } from '@/api/wcs/pathDetails/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { wcs_is_flag } = toRefs<any>(proxy?.useDict('wcs_is_flag')); const { wcs_is_flag } = toRefs<any>(proxy?.useDict('wcs_is_flag'));
const pathInfoList = ref<PathInfoVO[]>([]); const pathInfoList = ref<PathInfoVO[]>([]);
const detailList = ref<PathDetailsVO[]>([]);
const buttonLoading = ref(false); const buttonLoading = ref(false);
const loading = ref(true); const loading = ref(true);
const showSearch = ref(true); const showSearch = ref(true);
const activeTab = ref('basic');
const ids = ref<Array<string | number>>([]); const ids = ref<Array<string | number>>([]);
const single = ref(true); const single = ref(true);
const multiple = ref(true); const multiple = ref(true);
@ -149,32 +176,28 @@ const initFormData: PathInfoForm = {
objId: undefined, objId: undefined,
pathCode: undefined, pathCode: undefined,
pathName: undefined, pathName: undefined,
isFlag: undefined, isFlag: 1,
remark: undefined, remark: undefined,
createdTime: undefined,
} }
const data = reactive<PageData<PathInfoForm, PathInfoQuery>>({ const data = reactive<PageData<PathInfoForm, PathInfoQuery>>({
form: {...initFormData}, form: { ...initFormData },
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
pathCode: undefined, pathCode: undefined,
pathName: undefined, pathName: undefined,
isFlag: undefined, isFlag: undefined,
createdTime: undefined, params: {}
params: {
}
}, },
rules: { rules: {
objId: [ pathCode: [
{ required: true, message: "主键标识不能为空", trigger: "blur" } { required: true, message: "路径编号不能为空", trigger: "blur" }
], ],
} }
}); });
const { queryParams, form, rules } = toRefs(data); const { queryParams, form, rules } = toRefs(data);
/** 查询路径信息列表 */
const getList = async () => { const getList = async () => {
loading.value = true; loading.value = true;
const res = await listPathInfo(queryParams.value); const res = await listPathInfo(queryParams.value);
@ -183,63 +206,78 @@ const getList = async () => {
loading.value = false; loading.value = false;
} }
/** 取消按钮 */
const cancel = () => { const cancel = () => {
reset(); reset();
dialog.visible = false; dialog.visible = false;
} }
/** 表单重置 */
const reset = () => { const reset = () => {
form.value = {...initFormData}; form.value = { ...initFormData, isFlag: 1 };
detailList.value = [];
activeTab.value = 'basic';
pathInfoFormRef.value?.resetFields(); pathInfoFormRef.value?.resetFields();
} }
/** 搜索按钮操作 */
const handleQuery = () => { const handleQuery = () => {
queryParams.value.pageNum = 1; queryParams.value.pageNum = 1;
getList(); getList();
} }
/** 重置按钮操作 */
const resetQuery = () => { const resetQuery = () => {
queryFormRef.value?.resetFields(); queryFormRef.value?.resetFields();
handleQuery(); handleQuery();
} }
/** 多选框选中数据 */
const handleSelectionChange = (selection: PathInfoVO[]) => { const handleSelectionChange = (selection: PathInfoVO[]) => {
ids.value = selection.map(item => item.objId); ids.value = selection.map(item => item.objId);
single.value = selection.length != 1; single.value = selection.length != 1;
multiple.value = !selection.length; multiple.value = !selection.length;
} }
/** 新增按钮操作 */
const handleAdd = () => { const handleAdd = () => {
reset(); reset();
dialog.visible = true; dialog.visible = true;
dialog.title = "添加路径信息"; dialog.title = "添加路径信息";
} }
/** 修改按钮操作 */
const handleUpdate = async (row?: PathInfoVO) => { const handleUpdate = async (row?: PathInfoVO) => {
reset(); reset();
const _objId = row?.objId || ids.value[0] const _objId = row?.objId || ids.value[0]
const res = await getPathInfo(_objId); const res = await getPathInfo(_objId);
Object.assign(form.value, res.data); Object.assign(form.value, res.data);
if (res.data.details) {
detailList.value = res.data.details.map((d: PathDetailsVO) => ({ ...d }));
}
dialog.visible = true; dialog.visible = true;
dialog.title = "修改路径信息"; dialog.title = "修改路径信息";
} }
/** 提交按钮 */ const handleAddDetail = () => {
detailList.value.push({
objId: undefined,
pathCode: form.value.pathCode || '',
startPoint: '',
endPoint: '',
isFlag: 1,
remark: '',
createdTime: '',
} as unknown as PathDetailsVO);
}
const handleDelDetail = (index: number) => {
detailList.value.splice(index, 1);
}
const submitForm = () => { const submitForm = () => {
pathInfoFormRef.value?.validate(async (valid: boolean) => { pathInfoFormRef.value?.validate(async (valid: boolean) => {
if (valid) { if (valid) {
buttonLoading.value = true; buttonLoading.value = true;
//
(form.value as any).details = detailList.value;
if (form.value.objId) { if (form.value.objId) {
await updatePathInfo(form.value).finally(() => buttonLoading.value = false); await updatePathInfo(form.value).finally(() => buttonLoading.value = false);
} else { } else {
await addPathInfo(form.value).finally(() => buttonLoading.value = false); await addPathInfo(form.value).finally(() => buttonLoading.value = false);
} }
proxy?.$modal.msgSuccess("操作成功"); proxy?.$modal.msgSuccess("操作成功");
dialog.visible = false; dialog.visible = false;
@ -248,7 +286,6 @@ const submitForm = () => {
}); });
} }
/** 删除按钮操作 */
const handleDelete = async (row?: PathInfoVO) => { const handleDelete = async (row?: PathInfoVO) => {
const _objIds = row?.objId || ids.value; const _objIds = row?.objId || ids.value;
await proxy?.$modal.confirm('是否确认删除路径信息编号为"' + _objIds + '"的数据项?').finally(() => loading.value = false); await proxy?.$modal.confirm('是否确认删除路径信息编号为"' + _objIds + '"的数据项?').finally(() => loading.value = false);
@ -257,11 +294,8 @@ const handleDelete = async (row?: PathInfoVO) => {
await getList(); await getList();
} }
/** 导出按钮操作 */
const handleExport = () => { const handleExport = () => {
proxy?.download('wcs/pathInfo/export', { proxy?.download('wcs/pathInfo/export', { ...queryParams.value }, `pathInfo_${new Date().getTime()}.xlsx`)
...queryParams.value
}, `pathInfo_${new Date().getTime()}.xlsx`)
} }
onMounted(() => { onMounted(() => {

Loading…
Cancel
Save