devicesmgt/sgzb-ui/src/views/store/shelves/shelvesConfig.vue

357 lines
11 KiB
Vue
Raw Normal View History

2023-12-12 13:36:08 +08:00
<template>
2024-01-22 09:18:46 +08:00
<div class="app-container" id="shelvesConfig">
2023-12-12 13:36:08 +08:00
<el-row :gutter="20">
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="houseName"
placeholder="请输入货架名称"
2024-03-11 14:57:03 +08:00
clearable maxlength="50"
2023-12-12 13:36:08 +08:00
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="deptOptions"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
2024-04-10 17:04:07 +08:00
<el-form-item label="关键字" prop="keyWord">
2023-12-12 13:36:08 +08:00
<el-input
2024-04-10 17:04:07 +08:00
v-model="queryParams.keyWord"
2023-12-12 13:36:08 +08:00
placeholder="请输入关键字"
2024-03-11 14:57:03 +08:00
clearable maxlength="50"
2023-12-12 13:36:08 +08:00
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<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
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
>导出</el-button>
2023-12-12 13:36:08 +08:00
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['system:user:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['system:user:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['system:user:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:user:export']"
>导出</el-button>
</el-col> -->
2023-12-23 16:03:15 +08:00
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" ></right-toolbar>
2023-12-12 13:36:08 +08:00
</el-row>
<el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" />
2023-12-19 04:26:18 +08:00
<el-table-column label="序号" align="center" type="index" />
2023-12-23 16:03:15 +08:00
<el-table-column label="物品种类" align="center" key="itemType" prop="itemType" class-name="" :show-overflow-tooltip="true" />
<el-table-column label="类型名称" align="center" key="machineTypeName" prop="machineTypeName" :show-overflow-tooltip="true" />
<el-table-column label="规格型号" align="center" key="specificationType" prop="specificationType" :show-overflow-tooltip="true" />
<el-table-column label="设备编码" align="center" key="maCode" prop="maCode" />
<el-table-column label="货架编号" align="center" key="houseName" prop="houseName" :show-overflow-tooltip="true" />
2023-12-12 13:36:08 +08:00
<el-table-column
label="操作"
align="center"
width="160"
class-name="small-padding fixed-width"
>
<template slot-scope="scope" v-if="scope.row.houseId !== 1">
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['system:user:edit']"-->
<!-- >修改</el-button>-->
2023-12-23 16:03:15 +08:00
<!-- <el-button
2023-12-12 13:36:08 +08:00
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
2023-12-23 16:03:15 +08:00
>删除</el-button> -->
2023-12-12 13:36:08 +08:00
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-col>
</el-row>
2024-04-10 17:04:07 +08:00
2023-12-12 13:36:08 +08:00
</div>
</template>
<script>
import { listHouseTree,getHouseSet,delHouseSet,addhouseSet,updateHouseSet } from "@/api/store/shelves";
import { getToken } from "@/utils/auth";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
2024-01-22 09:18:46 +08:00
name: "ShelvesConfig",
2023-12-12 13:36:08 +08:00
dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Treeselect },
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 用户表格数据
userList: null,
// 弹出层标题
title: "",
// 部门树选项
deptOptions: undefined,
// 是否显示弹出层
open: false,
// 部门名称
houseName: undefined,
// 默认密码
initPassword: undefined,
// 日期范围
dateRange: [],
// 岗位选项
postOptions: [],
// 角色选项
roleOptions: [],
// 表单参数
form: {},
defaultProps: {
children: "children",
label: "label"
},
// 用户导入参数
upload: {
// 是否显示弹出层(用户导入)
open: false,
// 弹出层标题(用户导入)
title: "",
// 是否禁用上传
isUploading: false,
// 是否更新已经存在的用户数据
updateSupport: 0,
// 设置上传的请求头部
headers: { Authorization: "Bearer " + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/system/user/importData"
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userName: undefined,
phonenumber: undefined,
status: undefined,
deptId: undefined
},
2023-12-23 16:03:15 +08:00
2023-12-12 13:36:08 +08:00
// 表单校验
rules: {
userName: [
{ required: true, message: "用户名称不能为空", trigger: "blur" },
{ min: 2, max: 20, message: '用户名称长度必须介于 2 和 20 之间', trigger: 'blur' }
],
nickName: [
{ required: true, message: "用户昵称不能为空", trigger: "blur" }
],
password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
],
email: [
{
type: "email",
message: "请输入正确的邮箱地址",
trigger: ["blur", "change"]
}
],
phonenumber: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}
]
}
};
},
watch: {
// 根据名称筛选部门树
houseName(val) {
this.$refs.tree.filter(val);
}
},
created() {
this.getList();
this.getDeptTree();
},
methods: {
/** 查询用户列表 */
getList() {
this.loading = true;
getHouseSet(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.userList = response.rows;
this.total = response.total;
this.loading = false;
}
);
},
/** 查询部门下拉树结构 */
getDeptTree() {
listHouseTree().then(response => {
this.deptOptions = response.data;
});
},
// 筛选节点
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
// 节点单击事件
handleNodeClick(data) {
2023-12-23 16:03:15 +08:00
// this.queryParams.deptId = data.id;
// this.handleQuery();
2023-12-12 13:36:08 +08:00
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
houseId: undefined,
deptId: undefined,
userName: undefined,
nickName: undefined,
password: undefined,
phonenumber: undefined,
email: undefined,
sex: undefined,
status: "0",
remark: undefined,
postIds: [],
roleIds: []
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.queryParams.deptId = undefined;
this.$refs.tree.setCurrentKey(null);
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.houseId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
2024-04-10 17:04:07 +08:00
2023-12-12 13:36:08 +08:00
},
/** 修改按钮操作 */
handleUpdate(row) {
2024-04-10 17:04:07 +08:00
2023-12-12 13:36:08 +08:00
},
2024-04-10 17:04:07 +08:00
2023-12-12 13:36:08 +08:00
/** 删除按钮操作 */
handleDelete(row) {
2024-04-10 17:04:07 +08:00
2023-12-12 13:36:08 +08:00
},
/** 导出按钮操作 */
handleExport() {
// this.download('system/user/export', {
// ...this.queryParams
// }, `user_${new Date().getTime()}.xlsx`)
2023-12-12 13:36:08 +08:00
},
2024-04-10 17:04:07 +08:00
2023-12-12 13:36:08 +08:00
}
};
</script>