新增轮胎信息界面

master
夜笙歌 2 years ago
parent bee56363a8
commit 1bea80f36d

@ -0,0 +1,391 @@
<template>
<div class="app-container">
<!-- 搜索栏-->
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
<el-form-item label="轮胎品牌" prop="brand">
<el-select v-model="queryParams.brand" placeholder="请选择轮胎品牌" clearable style="width: 200px">
<el-option
v-for="dict in searchCriteria.brand"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="轮胎型号" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择轮胎型号" clearable style="width: 200px">
<el-option
v-for="dict in searchCriteria.type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="车牌号" prop="licensePlateNumber">
<el-input
v-model="queryParams.licensePlateNumber"
placeholder="请输入车牌号"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="轮胎编号" prop="serialNumber">
<el-input
v-model="queryParams.serialNumber"
placeholder="请输入轮胎编号"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="RFID" prop="RFID">
<el-input
v-model="queryParams.RFID"
placeholder="请输入RFID"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="轮位" prop="WheelPosition">
<el-input
v-model="queryParams.WheelPosition"
placeholder="请输入轮位"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="轮胎传感器ID" prop="sensorID">
<el-input
v-model="queryParams.sensorID"
placeholder="请输入轮胎传感器ID"
clearable
style="width: 200px"
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="创建时间" prop="postName">
<el-date-picker
v-model="queryParams.time"
type="daterange"
range-separator="至"
start-placeholder="开始时间"
end-placeholder="结束时间"
:size="size"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- 顶部操作按钮-->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['system:post:add']"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:post:edit']"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:post:remove']"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['system:post:export']"
>导出
</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 表格主体-->
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="岗位编号" align="center" prop="postId"/>
<el-table-column label="岗位编码" align="center" prop="postCode"/>
<el-table-column label="岗位名称" align="center" prop="postName"/>
<el-table-column label="岗位排序" align="center" prop="postSort"/>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status"/>
</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-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:post:edit']">
修改
</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:post:remove']">删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页-->
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改岗位对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="postRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="轮胎品牌" prop="brand">
<el-select v-model="form.brand" placeholder="请选择轮胎品牌" clearable style="width: 200px">
<el-option
v-for="dict in searchCriteria.brand"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="轮胎型号" prop="type">
<el-select v-model="form.type" placeholder="请选择轮胎型号" clearable style="width: 200px">
<el-option
v-for="dict in searchCriteria.type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="轮胎编号" prop="serialNumber">
<el-input v-model="form.serialNumber" placeholder="请输入岗位名称"/>
</el-form-item>
<el-form-item label="RFID" prop="RFID">
<el-input v-model="form.RFID" placeholder="请输入岗位名称"/>
</el-form-item>
<el-form-item label="当前轮胎传感器ID" prop="sensorID">
<el-input v-model="form.sensorID" placeholder="请输入岗位名称"/>
</el-form-item>
<el-form-item label="当前花纹深度" prop="depth">
<el-input-number v-model="form.depth" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Post">
import {addPost, delPost, getPost, listPost, updatePost} from "@/api/system/post";
const searchCriteria = {
brand: [
{
label: '玲珑',
value: '玲珑'
},
{
label: '利奥',
value: '利奥'
}
],
type: [
{
label: '11R22.5',
value: '11R22.5'
},
{
label: '12R22.5',
value: '12R22.5'
},
{
label: 'R567',
value: 'R567'
},
]
}
const {proxy} = getCurrentInstance();
const {sys_normal_disable} = proxy.useDict("sys_normal_disable");
const postList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
brand: undefined,
type: undefined,
licensePlateNumber: undefined,
serialNumber: undefined,
RFID: undefined,
WheelPosition: undefined,
sensorID: undefined,
time: null,
},
rules: {
brand: [{required: true, message: "轮胎品牌不能为空", trigger: "blur"}],
type: [{required: true, message: "轮胎型号不能为空", trigger: "blur"}],
serialNumber: [{required: true, message: "轮胎编号不能为空", trigger: "blur"}],
depth: [{required: true, message: "当前花纹深度不能为空", trigger: "blur"}],
}
});
const {queryParams, form, rules} = toRefs(data);
/** 查询岗位列表 */
function getList() {
loading.value = true;
listPost(queryParams.value).then(response => {
postList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
brand: undefined,
type: undefined,
serialNumber: undefined,
RFID: undefined,
sensorID: undefined,
depth: undefined
};
proxy.resetForm("postRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.postId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加岗位";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const postId = row.postId || ids.value;
getPost(postId).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改岗位";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["postRef"].validate(valid => {
if (valid) {
if (form.value.postId != undefined) {
updatePost(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addPost(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const postIds = row.postId || ids.value;
proxy.$modal.confirm('是否确认删除岗位编号为"' + postIds + '"的数据项?').then(function () {
return delPost(postIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {
});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("system/post/export", {
...queryParams.value
}, `post_${new Date().getTime()}.xlsx`);
}
getList();
</script>
Loading…
Cancel
Save