feat(情报板类型定义前端界面修改):
This commit is contained in:
parent
9482f87dc5
commit
a32ba2c6b9
|
@ -1,44 +1,44 @@
|
||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
// 查询情报板类型列表
|
// 查询情报板类型列表
|
||||||
export function listType(query) {
|
export function listBoardType(query) {
|
||||||
return request({
|
return request({
|
||||||
url: '/boardType/type/list',
|
url: '/board/boardType/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询情报板类型详细
|
// 查询情报板类型详细
|
||||||
export function getType(id) {
|
export function getBoardType(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/boardType/type/' + id,
|
url: '/board/boardType/' + id,
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增情报板类型
|
// 新增情报板类型
|
||||||
export function addType(data) {
|
export function addBoardType(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/boardType/type',
|
url: '/board/boardType',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改情报板类型
|
// 修改情报板类型
|
||||||
export function updateType(data) {
|
export function updateBoardType(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/boardType/type',
|
url: '/board/boardType',
|
||||||
method: 'put',
|
method: 'put',
|
||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除情报板类型
|
// 删除情报板类型
|
||||||
export function delType(id) {
|
export function delBoardType(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/boardType/type/' + id,
|
url: '/board/boardType/' + id,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,6 @@
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="尺寸" prop="size">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.size"
|
|
||||||
placeholder="请输入尺寸"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
@ -31,8 +23,9 @@
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['boardType:type:add']"
|
v-hasPermi="['board:boardType:add']"
|
||||||
>新增</el-button>
|
>新增
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -42,8 +35,9 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['boardType:type:edit']"
|
v-hasPermi="['board:boardType:edit']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -53,28 +47,19 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['boardType:type:remove']"
|
v-hasPermi="['board:boardType:remove']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
</el-col>
|
</el-button>
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['boardType:type:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="boardTypeList" @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="${comment}" align="center" prop="id" />
|
<el-table-column label="唯一编号" align="center" prop="id"/>
|
||||||
<el-table-column label="名称" align="center" prop="name" />
|
<el-table-column label="名称" align="center" prop="name"/>
|
||||||
<el-table-column label="类型" align="center" prop="type" />
|
<el-table-column label="类型" align="center" prop="type"/>
|
||||||
<el-table-column label="尺寸" align="center" prop="size" />
|
<el-table-column label="尺寸" align="center" prop="size"/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
|
@ -82,15 +67,17 @@
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['boardType:type:edit']"
|
v-hasPermi="['board:boardType:edit']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['boardType:type:remove']"
|
v-hasPermi="['board:boardType:remove']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -105,12 +92,25 @@
|
||||||
|
|
||||||
<!-- 添加或修改情报板类型对话框 -->
|
<!-- 添加或修改情报板类型对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="auto">
|
||||||
<el-form-item label="名称" prop="name">
|
<el-form-item label="名称" prop="name">
|
||||||
<el-input v-model="form.name" placeholder="请输入名称" />
|
<el-input v-model="form.name" placeholder="请输入名称"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="尺寸" prop="size">
|
<el-form-item label="类型" prop="type">
|
||||||
<el-input v-model="form.size" placeholder="请输入尺寸" />
|
<el-input v-model="form.type" placeholder="请输入类型"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="尺寸(高*长)" prop="size">
|
||||||
|
<el-row align="middle">
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-input-number :controls="false" v-model="form.height" placeholder="请输入尺寸" size="small"/>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="4" align="middle">
|
||||||
|
<div>*</div>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="8">
|
||||||
|
<el-input-number :controls="false" v-model="form.width" placeholder="请输入尺寸" size="small"/>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listType, getType, delType, addType, updateType } from "@/api/board/boardtype";
|
import {listBoardType, getBoardType, delBoardType, addBoardType, updateBoardType} from "@/api/board/boardtype";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "BoardType",
|
name: "BoardType",
|
||||||
|
@ -141,7 +141,7 @@ export default {
|
||||||
// 总条数
|
// 总条数
|
||||||
total: 0,
|
total: 0,
|
||||||
// 情报板类型表格数据
|
// 情报板类型表格数据
|
||||||
typeList: [],
|
boardTypeList: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: "",
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
|
@ -159,13 +159,23 @@ export default {
|
||||||
// 表单校验
|
// 表单校验
|
||||||
rules: {
|
rules: {
|
||||||
name: [
|
name: [
|
||||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
{required: true, message: "名称不能为空", trigger: "change"}
|
||||||
],
|
],
|
||||||
type: [
|
type: [
|
||||||
{ required: true, message: "类型不能为空", trigger: "change" }
|
{required: true, message: "类型不能为空", trigger: "change"}
|
||||||
],
|
],
|
||||||
size: [
|
size: [
|
||||||
{ required: true, message: "尺寸不能为空", trigger: "blur" }
|
{
|
||||||
|
validator: (rule, value, callback) => {
|
||||||
|
if (!this.form.height || !this.form.width) {
|
||||||
|
callback(new Error('尺寸(高和长)不能为空'));
|
||||||
|
} else {
|
||||||
|
callback();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
trigger: 'change'
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -177,8 +187,8 @@ export default {
|
||||||
/** 查询情报板类型列表 */
|
/** 查询情报板类型列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
listType(this.queryParams).then(response => {
|
listBoardType(this.queryParams).then(response => {
|
||||||
this.typeList = response.rows;
|
this.boardTypeList = response.rows;
|
||||||
this.total = response.total;
|
this.total = response.total;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
});
|
});
|
||||||
|
@ -194,6 +204,8 @@ export default {
|
||||||
id: null,
|
id: null,
|
||||||
name: null,
|
name: null,
|
||||||
type: null,
|
type: null,
|
||||||
|
height: null,
|
||||||
|
width: null,
|
||||||
size: null
|
size: null
|
||||||
};
|
};
|
||||||
this.resetForm("form");
|
this.resetForm("form");
|
||||||
|
@ -211,7 +223,7 @@ export default {
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.id)
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
|
@ -224,8 +236,9 @@ export default {
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
const id = row.id || this.ids
|
const id = row.id || this.ids
|
||||||
getType(id).then(response => {
|
getBoardType(id).then(response => {
|
||||||
this.form = response.data;
|
this.form = response.data;
|
||||||
|
[this.form.height, this.form.width] = response.data.size.split("*").map(Number);
|
||||||
this.open = true;
|
this.open = true;
|
||||||
this.title = "修改情报板类型";
|
this.title = "修改情报板类型";
|
||||||
});
|
});
|
||||||
|
@ -234,14 +247,15 @@ export default {
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
|
this.form.size = this.form.height + '*' + this.form.width;
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateType(this.form).then(response => {
|
updateBoardType(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("修改成功");
|
this.$modal.msgSuccess("修改成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
addType(this.form).then(response => {
|
addBoardType(this.form).then(response => {
|
||||||
this.$modal.msgSuccess("新增成功");
|
this.$modal.msgSuccess("新增成功");
|
||||||
this.open = false;
|
this.open = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
@ -253,18 +267,19 @@ export default {
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids;
|
||||||
this.$modal.confirm('是否确认删除情报板类型编号为"' + ids + '"的数据项?').then(function() {
|
this.$modal.confirm('是否确认删除情报板类型编号为"' + ids + '"的数据项?').then(function () {
|
||||||
return delType(ids);
|
return delBoardType(ids);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList();
|
this.getList();
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess("删除成功");
|
||||||
}).catch(() => {});
|
}).catch(() => {
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/** 导出按钮操作 */
|
/** 导出按钮操作 */
|
||||||
handleExport() {
|
handleExport() {
|
||||||
this.download('boardType/type/export', {
|
this.download('board/boardType/export', {
|
||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `type_${new Date().getTime()}.xlsx`)
|
}, `boardType_${new Date().getTime()}.xlsx`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue