wcs_java/wcs_web/src/views/tabs/ConveyDeliverStand.vue

156 lines
7.3 KiB
Vue
Raw Normal View History

2026-01-28 14:14:31 +08:00
<script setup lang="ts">
2026-02-08 20:41:57 +08:00
import {onMounted, ref} from "vue";
2026-01-28 14:14:31 +08:00
import TrueFalseTagStyleFormatter from "@/plugin/formatter/TrueFalseTagStyleFormatter.ts";
import MessageUtils from "@/utils/MessageUtils.ts";
import ConveyStandApi from "@/api/conveyStand.ts";
import type {PageDataResponse} from "@/interface/api/PageDataResponse.ts";
import type {AppServeDataResponse} from "@/interface/api/AppServeDataResponse.ts";
import {AppServeResponseCodeEnum} from "@/constant/enums/AppServeResponseCodeEnum.ts";
import AddDeliverStand from "@/components/page/conveyStand/AddDeliverStand.vue";
import DeliverStandDetail from "@/components/page/conveyStand/DeliverStandDetail.vue";
import type {IConveyDeliverStandSearch} from "@/interface/page/convey/IConveyDeliverStandSearch.ts";
import type {IAppConveyDeliverStand} from "@/model/table/IAppConveyDeliverStand.ts";
2026-02-08 20:41:57 +08:00
import {menuStore} from "@/stores/menu.ts";
import AppPermission from "@/components/manage/AppPermission.vue";
2026-01-28 14:14:31 +08:00
2026-02-08 20:41:57 +08:00
const menuStoreInstance = menuStore();
2026-01-28 14:14:31 +08:00
const searchParams = ref<IConveyDeliverStandSearch>({});
const trueFalseTagStyleFormatter = new TrueFalseTagStyleFormatter();
const tableData = ref<IAppConveyDeliverStand[] | undefined>([]);
const pageSize = ref<number>(100); // 分页单页数据
const pageIndex = ref<number>(1); // 分页页码
const totalPages = ref<number | undefined>(0); // 总数据数
const showAdd = ref<boolean>(false); // 是否展示添加窗口
const showDetail = ref<boolean>(false); // 是否展示详情窗口
const detailData = ref<IAppConveyDeliverStand>({});
2026-02-08 20:41:57 +08:00
onMounted(() => {
query(); // 查询数据
});
2026-01-28 14:14:31 +08:00
// 查询
const query = () => {
2026-02-08 20:41:57 +08:00
if(!menuStoreInstance.checkOperationPermission('conveyDeliverStand:query')) {
return;
}
2026-01-28 14:14:31 +08:00
const loadingInstance = MessageUtils.loading('查询中...');
ConveyStandApi.queryDeliverStand(searchParams.value, pageSize.value, pageIndex.value).then((res) => {
const responseString = JSON.stringify(res.data);
const response = JSON.parse(responseString) as AppServeDataResponse<PageDataResponse<IAppConveyDeliverStand>>;
if (response && response.code == AppServeResponseCodeEnum.SUCCESS && response.data != undefined) {
tableData.value = response.data.data;
totalPages.value = response.data.totalCount;
MessageUtils.successMessage('查询成功');
} else {
MessageUtils.warningMessageBox(response.msg);
}
}).catch(() => {}).finally(() => {
loadingInstance.close();
});
};
// 重置查询参数
const resetInput = () => {
searchParams.value = {};
};
// 添加站台
const addStand = () => {
showAdd.value = true;
};
// 查看
const handleEdit = (index: number, row: any) => {
detailData.value = {
standId: row.standId,
standName: row.standName,
plcId: row.plcId,
areaId: row.areaId,
standStatus: row.standStatus,
router: row.router,
readArriveAddress: row.readArriveAddress,
writeTaskAddress: row.writeTaskAddress,
remark: row.remark
};
showDetail.value = true;
};
// 分页
const paginationChange = () => {
query();
};
</script>
<template>
<div style="margin-left: 10px;margin-top: 10px; width: calc(100vw - 280px);">
<h3>输送线站台管理发货站台</h3>
<el-row class="searchCard">
<el-row style="width: 100%;">
<el-form class="searchForm" v-model="searchParams" label-position="top" label-width="150px" inline>
<el-form-item label="站台号:" style="width: 250px;">
<el-input v-model="searchParams.standId" placeholder="支持模糊查询" clearable></el-input>
</el-form-item>
<el-form-item label="区域号:" style="width: 250px;">
<el-input v-model="searchParams.areaId" placeholder="支持模糊查询" clearable></el-input>
</el-form-item>
<el-form-item label="站台状态:" style="width: 250px;">
<el-select v-model="searchParams.standStatus" placeholder="请选择状态" clearable>
<el-option v-for="item in trueFalseTagStyleFormatter.canUseTagStyle" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
</el-row>
<el-row>
<el-button-group style="width: 100%;margin-left: 10px; margin-bottom: 10px">
2026-02-08 20:41:57 +08:00
<app-permission permission="conveyDeliverStand:query"><el-button type="primary" @click="query">查询/刷新</el-button></app-permission>
2026-01-28 14:14:31 +08:00
<el-button type="warning" @click="resetInput">重置查询参数</el-button>
2026-02-08 20:41:57 +08:00
<app-permission permission="conveyDeliverStand:add"><el-button type="success" @click="addStand">添加站台</el-button></app-permission>
2026-01-28 14:14:31 +08:00
</el-button-group>
</el-row>
</el-row>
<el-row class="dataTable">
<el-table :data="tableData" stripe border style="width: 100%" max-height="calc(100vh - 320px)">
<el-table-column type="index" width="80" label="序号" align="center" show-overflow-tooltip fixed="left"/>
<el-table-column prop="standId" label="站台号" width="150" align="center" show-overflow-tooltip />
<el-table-column prop="standName" label="站台名称" width="150" align="center" show-overflow-tooltip/>
<el-table-column prop="plcId" label="管辖的PLC" width="100" align="center" show-overflow-tooltip/>
<el-table-column prop="areaId" label="区域号" width="150" align="center" show-overflow-tooltip/>
<el-table-column prop="standStatus" label="站台状态" width="100" align="center" show-overflow-tooltip>
<template #default="scope">
<el-tag :type="trueFalseTagStyleFormatter.canUseTagStyleFormatter(scope.row.standStatus).type">
{{trueFalseTagStyleFormatter.canUseTagStyleFormatter(scope.row.standStatus).label }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="router" label="路向" width="100" align="center" show-overflow-tooltip/>
<el-table-column prop="readArriveAddress" label="读取到达的地址" width="150" align="center" show-overflow-tooltip/>
<el-table-column prop="writeTaskAddress" label="写入任务的地址" width="180" align="center" show-overflow-tooltip/>
<el-table-column prop="remark" label="备注" min-width="150" align="left" show-overflow-tooltip/>
<el-table-column label="操作" width="80" align="center" fixed="right">
<template #default="scope">
<el-button size="small" type="primary" @click="handleEdit(scope.$index, scope.row)">查看</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination style="margin: 10px"
background
v-model:current-page="pageIndex"
v-model:page-size="pageSize"
:page-sizes="[10, 100, 200, 300]"
size="small"
layout="total, sizes, prev, pager, next, jumper"
:total="totalPages"
@size-change="paginationChange"
@current-change="paginationChange"
/>
</el-row>
</div>
<!--添加发货站台-->
<AddDeliverStand v-model="showAdd" @reLoadingTableData="query"/>
<!--发货站台详情-->
<DeliverStandDetail v-model="showDetail" :formData="detailData" @reLoadingTableData="query"/>
</template>
<style scoped>
</style>