Compare commits
25 Commits
7426401c06
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
af168b96d8 | ||
| 43b8b8ad68 | |||
| b513a327bb | |||
| 56779e4a3b | |||
| 4abf1c4df2 | |||
| d9b9a76ac1 | |||
| 8364c0e9a9 | |||
| 538b695830 | |||
| 8b2f021cbe | |||
| 5a84f178f8 | |||
| 3503fada5e | |||
| 608b645828 | |||
| 2ed31b61c5 | |||
| 21f461b3d7 | |||
| ce116a9b42 | |||
| c41f9df248 | |||
| ba6396093e | |||
| 9ed20d1c66 | |||
| 7db683b852 | |||
| d6486c4efd | |||
| 482109445d | |||
| 1bcbd84b7b | |||
| 59d0312cad | |||
| 335c82ad07 | |||
| 941899e538 |
@@ -1,7 +1,7 @@
|
||||
# 页面标题
|
||||
VITE_APP_TITLE = 智汇管理系统11
|
||||
VITE_APP_TITLE = 智汇管理系统
|
||||
# 开发环境配置
|
||||
VITE_APP_ENV = 'development'
|
||||
|
||||
# 智汇管理系统/开发环境
|
||||
VITE_APP_BASE_API = 'http://192.168.1.5:8082'
|
||||
VITE_APP_BASE_API = 'http://192.168.1.6:8081'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "ruoyi",
|
||||
"version": "3.9.1",
|
||||
"description": "智汇管理系统",
|
||||
"author": "若依",
|
||||
"author": "智汇管理系统",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 21 KiB |
44
src/api/unique/code.js
Normal file
44
src/api/unique/code.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询唯一码管理列表
|
||||
export function listCode(query) {
|
||||
return request({
|
||||
url: '/unique/code/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询唯一码管理详细
|
||||
export function getCode(id) {
|
||||
return request({
|
||||
url: '/unique/code/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增唯一码管理
|
||||
export function addCode(data) {
|
||||
return request({
|
||||
url: '/unique/code',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改唯一码管理
|
||||
export function updateCode(data) {
|
||||
return request({
|
||||
url: '/unique/code',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除唯一码管理
|
||||
export function delCode(id) {
|
||||
return request({
|
||||
url: '/unique/code/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
43
src/api/worn/home.js
Normal file
43
src/api/worn/home.js
Normal file
@@ -0,0 +1,43 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getHomeStat() {
|
||||
return request({
|
||||
url: '/home/stat',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getHomeDeviceStat() {
|
||||
return request({
|
||||
url: '/home/device/stat',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getHomeAlarmStat() {
|
||||
return request({
|
||||
url: '/home/alarm/stat',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getHomeAlarmTrend() {
|
||||
return request({
|
||||
url: '/home/alarm/trend',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getHomeAlarmType() {
|
||||
return request({
|
||||
url: '/home/alarm/type',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function getHomeProjectList() {
|
||||
return request({
|
||||
url: '/home/warehouse/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/inboundBill.js
Normal file
44
src/api/worn/inboundBill.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询入库库存列表
|
||||
export function listInboundBill(query) {
|
||||
return request({
|
||||
url: '/worn/inboundBill/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询入库库存详细
|
||||
export function getInboundBill(id) {
|
||||
return request({
|
||||
url: '/worn/inboundBill/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增入库库存
|
||||
export function addInboundBill(data) {
|
||||
return request({
|
||||
url: '/worn/inboundBill',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改入库库存
|
||||
export function updateInboundBill(data) {
|
||||
return request({
|
||||
url: '/worn/inboundBill',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除入库库存
|
||||
export function delInboundBill(id) {
|
||||
return request({
|
||||
url: '/worn/inboundBill/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
51
src/api/worn/material.js
Normal file
51
src/api/worn/material.js
Normal file
@@ -0,0 +1,51 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询物料列表
|
||||
export function listMaterial(query) {
|
||||
return request({
|
||||
url: '/worn/material/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物料详细
|
||||
export function getMaterial(id) {
|
||||
return request({
|
||||
url: '/worn/material/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增物料
|
||||
export function addMaterial(data) {
|
||||
return request({
|
||||
url: '/worn/material',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改物料
|
||||
export function updateMaterial(data) {
|
||||
return request({
|
||||
url: '/worn/material',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除物料
|
||||
export function delMaterial(id) {
|
||||
return request({
|
||||
url: '/worn/material/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
// 获取物料类型的树形结构
|
||||
export function getMaterTypeTree() {
|
||||
return request({
|
||||
url: '/worn/type/tree' ,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/mqttCommand.js
Normal file
44
src/api/worn/mqttCommand.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询指令管理列表
|
||||
export function listMqttCommand(query) {
|
||||
return request({
|
||||
url: '/worn/mqttCommand/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询指令管理详细
|
||||
export function getMqttCommand(id) {
|
||||
return request({
|
||||
url: '/worn/mqttCommand/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增指令管理
|
||||
export function addMqttCommand(data) {
|
||||
return request({
|
||||
url: '/worn/mqttCommand',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改指令管理
|
||||
export function updateMqttCommand(data) {
|
||||
return request({
|
||||
url: '/worn/mqttCommand',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除指令管理
|
||||
export function delMqttCommand(id) {
|
||||
return request({
|
||||
url: '/worn/mqttCommand/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/mqttConfig.js
Normal file
44
src/api/worn/mqttConfig.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询MQTT主题配置列表
|
||||
export function listMqttConfig(query) {
|
||||
return request({
|
||||
url: '/worn/mqttConfig/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询MQTT主题配置详细
|
||||
export function getMqttConfig(id) {
|
||||
return request({
|
||||
url: '/worn/mqttConfig/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增MQTT主题配置
|
||||
export function addMqttConfig(data) {
|
||||
return request({
|
||||
url: '/worn/mqttConfig',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改MQTT主题配置
|
||||
export function updateMqttConfig(data) {
|
||||
return request({
|
||||
url: '/worn/mqttConfig',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除MQTT主题配置
|
||||
export function delMqttConfig(id) {
|
||||
return request({
|
||||
url: '/worn/mqttConfig/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/mqttData.js
Normal file
44
src/api/worn/mqttData.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询设备数据列表
|
||||
export function listMqttData(query) {
|
||||
return request({
|
||||
url: '/worn/mqttData/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备数据详细
|
||||
export function getMqttData(id) {
|
||||
return request({
|
||||
url: '/worn/mqttData/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增设备数据
|
||||
export function addMqttData(data) {
|
||||
return request({
|
||||
url: '/worn/mqttData',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改设备数据
|
||||
export function updateMqttData(data) {
|
||||
return request({
|
||||
url: '/worn/mqttData',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除设备数据
|
||||
export function delMqttData(id) {
|
||||
return request({
|
||||
url: '/worn/mqttData/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/mqttDevice.js
Normal file
44
src/api/worn/mqttDevice.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询MQTT设备列表
|
||||
export function listMqttDevice(query) {
|
||||
return request({
|
||||
url: '/worn/mqttDevice/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询MQTT设备详细
|
||||
export function getMqttDevice(id) {
|
||||
return request({
|
||||
url: '/worn/mqttDevice/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增MQTT设备
|
||||
export function addMqttDevice(data) {
|
||||
return request({
|
||||
url: '/worn/mqttDevice',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改MQTT设备
|
||||
export function updateMqttDevice(data) {
|
||||
return request({
|
||||
url: '/worn/mqttDevice',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除MQTT设备
|
||||
export function delMqttDevice(id) {
|
||||
return request({
|
||||
url: '/worn/mqttDevice/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/mqttEvent.js
Normal file
44
src/api/worn/mqttEvent.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询设备事件列表
|
||||
export function listMqttEvent(query) {
|
||||
return request({
|
||||
url: '/worn/mqttEvent/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询设备事件详细
|
||||
export function getMqttEvent(id) {
|
||||
return request({
|
||||
url: '/worn/mqttEvent/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增设备事件
|
||||
export function addMqttEvent(data) {
|
||||
return request({
|
||||
url: '/worn/mqttEvent',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改设备事件
|
||||
export function updateMqttEvent(data) {
|
||||
return request({
|
||||
url: '/worn/mqttEvent',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除设备事件
|
||||
export function delMqttEvent(id) {
|
||||
return request({
|
||||
url: '/worn/mqttEvent/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
33
src/api/worn/socket.js
Normal file
33
src/api/worn/socket.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 智能排风远程开关
|
||||
export function controlSocket(data) {
|
||||
const payload = {
|
||||
devEui: data.devEui,
|
||||
deviceId: data.deviceId,
|
||||
status: data.status
|
||||
}
|
||||
|
||||
return request({
|
||||
url: '/worn/socket/control',
|
||||
method: 'post',
|
||||
params: payload,
|
||||
data: payload
|
||||
})
|
||||
}
|
||||
|
||||
// 智慧照明开关远程控制
|
||||
export function controlLightSwitch(data) {
|
||||
const payload = {
|
||||
devEui: data.devEui,
|
||||
channel: data.channel,
|
||||
status: data.status
|
||||
}
|
||||
|
||||
return request({
|
||||
url: '/worn/socket/switch',
|
||||
method: 'post',
|
||||
params: payload,
|
||||
data: payload
|
||||
})
|
||||
}
|
||||
44
src/api/worn/threshold.js
Normal file
44
src/api/worn/threshold.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询传感器阈值配置列表
|
||||
export function listThreshold(query) {
|
||||
return request({
|
||||
url: '/worn/threshold/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询传感器阈值配置详细
|
||||
export function getThreshold(id) {
|
||||
return request({
|
||||
url: '/worn/threshold/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增传感器阈值配置
|
||||
export function addThreshold(data) {
|
||||
return request({
|
||||
url: '/worn/threshold',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改传感器阈值配置
|
||||
export function updateThreshold(data) {
|
||||
return request({
|
||||
url: '/worn/threshold',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除传感器阈值配置
|
||||
export function delThreshold(id) {
|
||||
return request({
|
||||
url: '/worn/threshold/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/type.js
Normal file
44
src/api/worn/type.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询废旧系统物料类型(支持父子级树结构)列表
|
||||
export function listType(query) {
|
||||
return request({
|
||||
url: '/worn/type/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询废旧系统物料类型(支持父子级树结构)详细
|
||||
export function getType(id) {
|
||||
return request({
|
||||
url: '/worn/type/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增废旧系统物料类型(支持父子级树结构)
|
||||
export function addType(data) {
|
||||
return request({
|
||||
url: '/worn/type',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改废旧系统物料类型(支持父子级树结构)
|
||||
export function updateType(data) {
|
||||
return request({
|
||||
url: '/worn/type',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除废旧系统物料类型(支持父子级树结构)
|
||||
export function delType(id) {
|
||||
return request({
|
||||
url: '/worn/type/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
src/api/worn/unit.js
Normal file
44
src/api/worn/unit.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询物料单位列表
|
||||
export function listUnit(query) {
|
||||
return request({
|
||||
url: '/worn/unit/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询物料单位详细
|
||||
export function getUnit(id) {
|
||||
return request({
|
||||
url: '/worn/unit/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增物料单位
|
||||
export function addUnit(data) {
|
||||
return request({
|
||||
url: '/worn/unit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改物料单位
|
||||
export function updateUnit(data) {
|
||||
return request({
|
||||
url: '/worn/unit',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除物料单位
|
||||
export function delUnit(id) {
|
||||
return request({
|
||||
url: '/worn/unit/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
BIN
src/assets/images/loginBg.jpg
Normal file
BIN
src/assets/images/loginBg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 680 KiB |
BIN
src/assets/logo/logo.jpg
Normal file
BIN
src/assets/logo/logo.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
@@ -136,6 +136,40 @@ aside {
|
||||
}
|
||||
}
|
||||
|
||||
// main-container全局样式 - 手写非系统生成
|
||||
.app-container-page{
|
||||
padding: 24px;
|
||||
|
||||
// 样式一:列表页查询条件
|
||||
.table-form-search{
|
||||
padding: 24px;
|
||||
background-color: #ffffff;
|
||||
margin-bottom: 24px;
|
||||
border-radius: 4px;
|
||||
|
||||
.el-form-item__label{
|
||||
color:rgba(0, 0, 0, .9);
|
||||
font-weight: 500;
|
||||
}
|
||||
.el-form-item{
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
// 样式二:列表页table以及操作按钮样式
|
||||
.table-list{
|
||||
padding: 24px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 4px;
|
||||
|
||||
.el-table--default{
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
.components-container {
|
||||
margin: 30px 50px;
|
||||
position: relative;
|
||||
|
||||
@@ -288,3 +288,10 @@
|
||||
.splitpanes.default-theme .splitpanes__pane {
|
||||
background-color: var(--splitpanes-default-bg) !important;
|
||||
}
|
||||
|
||||
|
||||
// 查询按钮样式
|
||||
.searchBtn{
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
38
src/components/DepartmentCascaDer/index.vue
Normal file
38
src/components/DepartmentCascaDer/index.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<script setup>
|
||||
import { listDept } from '@/api/system/dept'
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
}
|
||||
});
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const emit = defineEmits(['update:modelValue']);
|
||||
const model = computed({
|
||||
get() {
|
||||
return props.modelValue;
|
||||
},
|
||||
set(val) {
|
||||
emit('update:modelValue', val);
|
||||
}
|
||||
});
|
||||
const departmentList = ref([]);
|
||||
function getDepartmentListFun() {
|
||||
listDept().then((response) => {
|
||||
departmentList.value = proxy.handleTree(response.data, "deptId")
|
||||
});
|
||||
}
|
||||
getDepartmentListFun();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-cascader :options="departmentList" style="width: 100%;" v-model="model" :props="{
|
||||
children: 'children',
|
||||
label: 'deptName',
|
||||
value: 'deptId'
|
||||
}" @change="(val) => {
|
||||
console.log('111', val);
|
||||
|
||||
}" placeholder="请选择所属部门" />
|
||||
</template>
|
||||
@@ -174,7 +174,7 @@ onMounted(() => {
|
||||
float: left;
|
||||
height: 50px !important;
|
||||
line-height: 50px !important;
|
||||
color: #999093 !important;
|
||||
color: #999093 ;
|
||||
padding: 0 5px !important;
|
||||
margin: 0 10px !important;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import logo from '@/assets/logo/logo.png'
|
||||
import logo from '@/assets/logo/logo.jpg'
|
||||
import useSettingsStore from '@/store/modules/settings'
|
||||
import variables from '@/assets/styles/variables.module.scss'
|
||||
|
||||
|
||||
@@ -83,6 +83,19 @@ export const constantRoutes = [
|
||||
meta: { title: '个人中心', icon: 'user' }
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/worn/warehouse-dashboard',
|
||||
component: Layout,
|
||||
hidden: true,
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: () => import('@/views/worn/warehouseDashboard/index'),
|
||||
name: 'WarehouseDashboard',
|
||||
meta: { title: '仓库传感器看板', activeMenu: '/index' }
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -56,6 +56,6 @@ export default {
|
||||
/**
|
||||
* 底部版权文本内容
|
||||
*/
|
||||
footerContent: 'Copyright © 2018-2026 RuoYi. All Rights Reserved.'
|
||||
footerContent: 'Copyright © All Rights Reserved.'
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ const useSettingsStore = defineStore(
|
||||
state: () => ({
|
||||
title: '',
|
||||
topNav: storageSetting.topNav ===undefined ? topNav:storageSetting.topNav,
|
||||
theme: storageSetting.theme || '#409EFF',
|
||||
theme: storageSetting.theme || 'RGB(0, 145, 145)',
|
||||
sideTheme: storageSetting.sideTheme || sideTheme,
|
||||
showSettings: showSettings,
|
||||
navType: storageSetting.navType === undefined ? navType : storageSetting.navType,
|
||||
|
||||
153
src/utils/until.js
Normal file
153
src/utils/until.js
Normal file
@@ -0,0 +1,153 @@
|
||||
// 等级
|
||||
export const levelTypeMenu = [
|
||||
{ value: "HIGH", label: "高危/高等级告警" },
|
||||
{ value: "MEDIUM", label: "中危/中等级告警" },
|
||||
{ value: "LOW", label: "低危/恢复/普通状态变化" },
|
||||
{ value: "INFO", label: "信息/普通事件" },
|
||||
];
|
||||
// 唯一码状态
|
||||
export const statusMenu = [
|
||||
{
|
||||
value: 0,
|
||||
label: "初始化创建",
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
label: "入库单开单",
|
||||
},
|
||||
{
|
||||
value: 2,
|
||||
label: "已入库",
|
||||
},
|
||||
{
|
||||
value: 3,
|
||||
label: "出库单开单",
|
||||
},
|
||||
{
|
||||
value: 4,
|
||||
label: "已出库",
|
||||
},
|
||||
{
|
||||
value: 9,
|
||||
label: "已作废",
|
||||
},
|
||||
];
|
||||
// 入库单、出库单状态
|
||||
const billTypeMenu = [
|
||||
{
|
||||
value: "0",
|
||||
label: "已提交",
|
||||
},
|
||||
{
|
||||
value: "1",
|
||||
label: "已完成",
|
||||
},
|
||||
{
|
||||
value: "4",
|
||||
label: "已取消",
|
||||
},
|
||||
];
|
||||
|
||||
// 订单状态为0时 再查一次
|
||||
const billStatueMenu = [
|
||||
{
|
||||
value: "0",
|
||||
label: "库单已提交",
|
||||
},
|
||||
{
|
||||
value: "1",
|
||||
label: "全部入库",
|
||||
},
|
||||
{
|
||||
value: "2",
|
||||
label: "物料部分",
|
||||
},
|
||||
];
|
||||
/**
|
||||
* 根据传入数组和id,找到他的label
|
||||
* @param {String} deptId value
|
||||
* @param {Array} list 映射数组
|
||||
* @param {Object} info 映射数组对应的label、name字段名
|
||||
* @returns {String} label
|
||||
*/
|
||||
export const getDictLabel = (
|
||||
deptId,
|
||||
list,
|
||||
info = { name: "label", value: "value" },
|
||||
) => {
|
||||
const { name, value } = info;
|
||||
return list.find((i) => `${i?.[value]}` === `${deptId}`)?.[name] || "-";
|
||||
};
|
||||
/**
|
||||
* 根据部门ID,递归查找它的完整层级ID路径 [祖先..., 自己]
|
||||
* @param {Array} tree 部门树
|
||||
* @param {Number} targetDeptId 要找的部门ID
|
||||
* @returns {Array} 完整ID路径
|
||||
*/
|
||||
export function getDeptIdPath(tree, targetDeptId) {
|
||||
for (const item of tree) {
|
||||
// 如果当前就是目标,返回自己
|
||||
if (item.deptId === targetDeptId) {
|
||||
return [item.deptId];
|
||||
}
|
||||
// 如果有子节点,递归找
|
||||
if (item.children && item.children.length) {
|
||||
const res = getDeptIdPath(item.children, targetDeptId);
|
||||
if (res.length) {
|
||||
return [item.deptId, ...res];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取入库/出库单状态展示文本
|
||||
* @param {any} val - 状态
|
||||
* @param {string|number} status - 物料状态
|
||||
* @param {number} flag - 1=出库 0=入库
|
||||
* @returns {string} 状态文本
|
||||
*/
|
||||
export const getBillType = (val, status, flag) => {
|
||||
const valStr = String(val);
|
||||
const statusStr = String(status);
|
||||
|
||||
if (valStr === "0") {
|
||||
const statusItem = billStatueMenu.find((item) => item.value === statusStr);
|
||||
if (!statusItem) return "";
|
||||
|
||||
const isOut = flag === 1;
|
||||
const stateVal = statusItem.value;
|
||||
|
||||
// 状态 0:前缀拼接 入/出
|
||||
if (stateVal === "0") {
|
||||
return isOut ? "出" + statusItem.label : "入" + statusItem.label;
|
||||
}
|
||||
|
||||
// 状态 2:后缀拼接 入库/出库
|
||||
if (stateVal === "2") {
|
||||
return isOut ? statusItem.label + "出库" : statusItem.label + "入库";
|
||||
}
|
||||
|
||||
// 其他状态直接返回
|
||||
return statusItem.label;
|
||||
}
|
||||
|
||||
// 非0:走普通单据类型菜单
|
||||
return billTypeMenu.find((item) => item.value === valStr)?.label || "";
|
||||
};
|
||||
// 获取出入库单的状态以及tag颜色
|
||||
export const getColor = (val, status) => {
|
||||
if (val == "0") {
|
||||
if (status == "0") {
|
||||
return "color:#e6a23c;font-weight:500;font-size:12px;";
|
||||
}
|
||||
if (status == "2") {
|
||||
return "color:#C0C0C0;font-weight:500;font-size:12px;";
|
||||
}
|
||||
} else if (val == "1") {
|
||||
return "color:#67c23a;font-weight:500;font-size:12px;";
|
||||
} else {
|
||||
return "color:#f56c6c;font-weight:500;font-size:12px;";
|
||||
}
|
||||
};
|
||||
175
src/utils/ws.js
Normal file
175
src/utils/ws.js
Normal file
@@ -0,0 +1,175 @@
|
||||
import { getToken } from '@/utils/auth'
|
||||
|
||||
let ws = null
|
||||
let reconnectTimer = null
|
||||
let manualClose = false
|
||||
let retryCount = 0
|
||||
const subscribers = new Set()
|
||||
|
||||
const WS_PATH = '/ws'
|
||||
const MAX_RECONNECT_DELAY = 30000
|
||||
|
||||
function getWsBaseUrl() {
|
||||
const baseApi = import.meta.env.VITE_APP_BASE_API || ''
|
||||
|
||||
if (/^https?:\/\//.test(baseApi)) {
|
||||
return baseApi.replace(/^http/, 'ws').replace(/\/$/, '')
|
||||
}
|
||||
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'
|
||||
return `${protocol}//${window.location.host}${baseApi}`.replace(/\/$/, '')
|
||||
}
|
||||
|
||||
function buildWsUrl() {
|
||||
const url = new URL(`${getWsBaseUrl()}${WS_PATH}`)
|
||||
const token = getToken()
|
||||
|
||||
if (token) {
|
||||
url.searchParams.set('token', token)
|
||||
}
|
||||
|
||||
return url.toString()
|
||||
}
|
||||
|
||||
export function connectWs(onMessage) {
|
||||
console.trace('connectWs called')
|
||||
if (!getToken()) {
|
||||
console.warn('[WebSocket] missing token')
|
||||
return
|
||||
}
|
||||
|
||||
if (typeof onMessage === 'function') {
|
||||
subscribers.add(onMessage)
|
||||
}
|
||||
|
||||
manualClose = false
|
||||
clearReconnectTimer()
|
||||
|
||||
if (ws && (ws.readyState === WebSocket.OPEN || ws.readyState === WebSocket.CONNECTING)) {
|
||||
return
|
||||
}
|
||||
|
||||
ws = new WebSocket(buildWsUrl())
|
||||
|
||||
ws.onopen = () => {
|
||||
retryCount = 0
|
||||
console.log('[WebSocket] connected')
|
||||
}
|
||||
|
||||
ws.onmessage = (event) => {
|
||||
let data = event.data
|
||||
|
||||
try {
|
||||
data = JSON.parse(event.data)
|
||||
} catch (e) {
|
||||
// Keep plain text messages as-is.
|
||||
}
|
||||
|
||||
subscribers.forEach((handler) => {
|
||||
try {
|
||||
handler(data, event)
|
||||
} catch (error) {
|
||||
console.error('[WebSocket] subscriber error', error)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
ws.onclose = (event) => {
|
||||
console.log('[WebSocket] closed', { code: event.code, reason: event.reason })
|
||||
ws = null
|
||||
|
||||
if (isNonRetryableClose(event)) {
|
||||
console.warn('[WebSocket] stop reconnect because close reason is not retryable', {
|
||||
code: event.code,
|
||||
reason: event.reason
|
||||
})
|
||||
retryCount = 0
|
||||
clearReconnectTimer()
|
||||
return
|
||||
}
|
||||
|
||||
if (!manualClose && subscribers.size > 0) {
|
||||
reconnectTimer = setTimeout(() => {
|
||||
console.log('[WebSocket] reconnecting')
|
||||
connectWs()
|
||||
}, getReconnectDelay())
|
||||
}
|
||||
}
|
||||
|
||||
ws.onerror = (error) => {
|
||||
console.error('[WebSocket] error', error)
|
||||
}
|
||||
}
|
||||
|
||||
export function closeWs(onMessage) {
|
||||
if (typeof onMessage === 'function') {
|
||||
subscribers.delete(onMessage)
|
||||
} else {
|
||||
subscribers.clear()
|
||||
}
|
||||
|
||||
if (subscribers.size > 0) {
|
||||
return
|
||||
}
|
||||
|
||||
manualClose = true
|
||||
retryCount = 0
|
||||
clearReconnectTimer()
|
||||
if (ws) {
|
||||
ws.close()
|
||||
ws = null
|
||||
}
|
||||
}
|
||||
|
||||
export function reconnectWs(onMessage) {
|
||||
if (typeof onMessage === 'function') {
|
||||
subscribers.add(onMessage)
|
||||
}
|
||||
|
||||
manualClose = false
|
||||
retryCount = 0
|
||||
clearReconnectTimer()
|
||||
|
||||
if (ws) {
|
||||
ws.close()
|
||||
ws = null
|
||||
}
|
||||
|
||||
manualClose = false
|
||||
connectWs()
|
||||
}
|
||||
|
||||
export function sendWs(data) {
|
||||
if (!ws || ws.readyState !== WebSocket.OPEN) {
|
||||
console.warn('[WebSocket] send failed, socket is not open')
|
||||
return false
|
||||
}
|
||||
|
||||
ws.send(typeof data === 'string' ? data : JSON.stringify(data))
|
||||
return true
|
||||
}
|
||||
|
||||
export function getWsState() {
|
||||
return ws ? ws.readyState : WebSocket.CLOSED
|
||||
}
|
||||
|
||||
function getReconnectDelay() {
|
||||
retryCount += 1
|
||||
return Math.min(5000 * retryCount, MAX_RECONNECT_DELAY)
|
||||
}
|
||||
|
||||
function clearReconnectTimer() {
|
||||
if (reconnectTimer) {
|
||||
clearTimeout(reconnectTimer)
|
||||
reconnectTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
function isNonRetryableClose(event) {
|
||||
const reason = (event?.reason || '').toLowerCase()
|
||||
return (
|
||||
reason.includes('invalid token') ||
|
||||
reason.includes('missing token') ||
|
||||
reason.includes('deptid is null')
|
||||
)
|
||||
}
|
||||
1168
src/views/index copy.vue
Normal file
1168
src/views/index copy.vue
Normal file
File diff suppressed because it is too large
Load Diff
2695
src/views/index.vue
2695
src/views/index.vue
File diff suppressed because it is too large
Load Diff
@@ -1,54 +1,34 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<div class="logo-box">
|
||||
<img v-if="logo" :src="logo" class="logo" />
|
||||
<h3 class="title">{{ title }}</h3>
|
||||
</div>
|
||||
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
type="text"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="账号"
|
||||
>
|
||||
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
type="password"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="密码"
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
|
||||
@keyup.enter="handleLogin">
|
||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaEnabled">
|
||||
<el-input
|
||||
v-model="loginForm.code"
|
||||
size="large"
|
||||
auto-complete="off"
|
||||
placeholder="验证码"
|
||||
style="width: 63%"
|
||||
@keyup.enter="handleLogin"
|
||||
>
|
||||
<el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%"
|
||||
@keyup.enter="handleLogin">
|
||||
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button
|
||||
:loading="loading"
|
||||
size="large"
|
||||
type="primary"
|
||||
style="width:100%;"
|
||||
@click.prevent="handleLogin"
|
||||
>
|
||||
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
@@ -70,7 +50,7 @@ import Cookies from "js-cookie"
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt"
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import defaultSettings from '@/settings'
|
||||
|
||||
import logo from '@/assets/logo/logo.jpg'
|
||||
const title = import.meta.env.VITE_APP_TITLE
|
||||
const footerContent = defaultSettings.footerContent
|
||||
const userStore = useUserStore()
|
||||
@@ -171,21 +151,38 @@ getCookie()
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-image: url("../assets/images/login-background.jpg");
|
||||
background-image: url("../assets/images/loginBg.jpg");
|
||||
background-size: cover;
|
||||
}
|
||||
.title {
|
||||
margin: 0px auto 30px auto;
|
||||
text-align: center;
|
||||
color: #707070;
|
||||
color: #1b222f;
|
||||
font-weight:500;
|
||||
font-size:18px;
|
||||
}
|
||||
|
||||
.login-form {
|
||||
padding: 24px;
|
||||
border-radius: 6px;
|
||||
background: #ffffff;
|
||||
width: 400px;
|
||||
padding: 25px 25px 5px 25px;
|
||||
z-index: 1;
|
||||
.logo-box {
|
||||
display: flex;
|
||||
margin: 0px auto 30px auto;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
}
|
||||
.el-button:hover {
|
||||
background-color: RGB(0, 145, 145);
|
||||
}
|
||||
.el-input {
|
||||
height: 40px;
|
||||
input {
|
||||
@@ -223,6 +220,8 @@ getCookie()
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
|
||||
|
||||
}
|
||||
.login-code-img {
|
||||
height: 40px;
|
||||
|
||||
268
src/views/login_bf.vue
Normal file
268
src/views/login_bf.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div class="login">
|
||||
<div class="login-box">
|
||||
<div class="login-left">
|
||||
<h1>登录</h1>
|
||||
<h1> {{ title }}</h1>
|
||||
</div>
|
||||
<div class="login-right">
|
||||
<h1 class="title">账号登录</h1>
|
||||
<el-form class="login-form" ref="loginRef" :model="loginForm" :rules="loginRules">
|
||||
|
||||
<el-form-item prop="username">
|
||||
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
|
||||
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
|
||||
@keyup.enter="handleLogin">
|
||||
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaEnabled">
|
||||
<el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%"
|
||||
@keyup.enter="handleLogin">
|
||||
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<!-- <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> -->
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
<div style="float: right;" v-if="register">
|
||||
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- 底部 -->
|
||||
<div class="el-login-footer">
|
||||
<span>{{ footerContent }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getCodeImg } from "@/api/login"
|
||||
import Cookies from "js-cookie"
|
||||
import { encrypt, decrypt } from "@/utils/jsencrypt"
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import defaultSettings from '@/settings'
|
||||
|
||||
const title = import.meta.env.VITE_APP_TITLE
|
||||
const footerContent = defaultSettings.footerContent
|
||||
const userStore = useUserStore()
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const loginForm = ref({
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
rememberMe: false,
|
||||
code: "",
|
||||
uuid: ""
|
||||
})
|
||||
|
||||
const loginRules = {
|
||||
username: [{ required: true, trigger: "blur", message: "请输入您的账号" }],
|
||||
password: [{ required: true, trigger: "blur", message: "请输入您的密码" }],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
||||
}
|
||||
|
||||
const codeUrl = ref("")
|
||||
const loading = ref(false)
|
||||
// 验证码开关
|
||||
const captchaEnabled = ref(true)
|
||||
// 注册开关
|
||||
const register = ref(false)
|
||||
const redirect = ref(undefined)
|
||||
|
||||
watch(route, (newRoute) => {
|
||||
redirect.value = newRoute.query && newRoute.query.redirect
|
||||
}, { immediate: true })
|
||||
|
||||
function handleLogin() {
|
||||
proxy.$refs.loginRef.validate(valid => {
|
||||
if (valid) {
|
||||
loading.value = true
|
||||
// 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
||||
if (loginForm.value.rememberMe) {
|
||||
Cookies.set("username", loginForm.value.username, { expires: 30 })
|
||||
Cookies.set("password", encrypt(loginForm.value.password), { expires: 30 })
|
||||
Cookies.set("rememberMe", loginForm.value.rememberMe, { expires: 30 })
|
||||
} else {
|
||||
// 否则移除
|
||||
Cookies.remove("username")
|
||||
Cookies.remove("password")
|
||||
Cookies.remove("rememberMe")
|
||||
}
|
||||
// 调用action的登录方法
|
||||
userStore.login(loginForm.value).then(() => {
|
||||
const query = route.query
|
||||
const otherQueryParams = Object.keys(query).reduce((acc, cur) => {
|
||||
if (cur !== "redirect") {
|
||||
acc[cur] = query[cur]
|
||||
}
|
||||
return acc
|
||||
}, {})
|
||||
router.push({ path: redirect.value || "/", query: otherQueryParams })
|
||||
}).catch(() => {
|
||||
loading.value = false
|
||||
// 重新获取验证码
|
||||
if (captchaEnabled.value) {
|
||||
getCode()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getCode() {
|
||||
getCodeImg().then(res => {
|
||||
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled
|
||||
if (captchaEnabled.value) {
|
||||
codeUrl.value = "data:image/gif;base64," + res.img
|
||||
loginForm.value.uuid = res.uuid
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getCookie() {
|
||||
const username = Cookies.get("username")
|
||||
const password = Cookies.get("password")
|
||||
const rememberMe = Cookies.get("rememberMe")
|
||||
loginForm.value = {
|
||||
username: username === undefined ? loginForm.value.username : username,
|
||||
password: password === undefined ? loginForm.value.password : decrypt(password),
|
||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
||||
}
|
||||
}
|
||||
|
||||
getCode()
|
||||
getCookie()
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
.login {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
background-color: #f1f7ff;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.login-box {
|
||||
width: 1200px;
|
||||
margin: 4% auto 40px;
|
||||
display: flex;
|
||||
height: 60%;
|
||||
}
|
||||
|
||||
.login-left {
|
||||
width: 50%;
|
||||
background-color: #fff;
|
||||
padding: 3%;
|
||||
border-radius: 16px 0 0 16px;
|
||||
}
|
||||
|
||||
.login-right {
|
||||
width: 50%;
|
||||
padding: 3%;
|
||||
border-radius: 0 16px 16px 0;
|
||||
background: RGB(0, 145, 145);
|
||||
|
||||
.title {
|
||||
color: #fff;
|
||||
margin-bottom: 80px;
|
||||
margin-top: 21px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
.login-form {
|
||||
width: 300px;
|
||||
z-index: 1;
|
||||
margin: 0 auto;
|
||||
color: #fff;
|
||||
|
||||
.el-form-item--default {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.el-button {
|
||||
background-color: #fff;
|
||||
color: RGB(0, 145, 145);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.el-input {
|
||||
height: 40px;
|
||||
|
||||
input {
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
.input-icon {
|
||||
height: 39px;
|
||||
width: 14px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.login-tip {
|
||||
font-size: 13px;
|
||||
text-align: center;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
.login-code {
|
||||
width: 33%;
|
||||
height: 40px;
|
||||
float: right;
|
||||
|
||||
img {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
|
||||
.el-login-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.login-code-img {
|
||||
height: 40px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -99,7 +99,7 @@
|
||||
import draggable from "vuedraggable/dist/vuedraggable.common"
|
||||
import ClipboardJS from 'clipboard'
|
||||
import beautifier from 'js-beautify'
|
||||
import logo from '@/assets/logo/logo.png'
|
||||
import logo from '@/assets/logo/logo.jpg'
|
||||
import { inputComponents, selectComponents, layoutComponents, formConf as formConfData } from '@/utils/generator/config'
|
||||
import { beautifierConf } from '@/utils/index'
|
||||
import drawingDefalut from '@/utils/generator/drawingDefalut'
|
||||
|
||||
298
src/views/unique/code/index.vue
Normal file
298
src/views/unique/code/index.vue
Normal file
@@ -0,0 +1,298 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form :model="queryParams" class="table-form-search" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="唯一码编号" prop="code">
|
||||
<el-input v-model="queryParams.code" placeholder="请输入唯一码编号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="所属入库单据号" prop="billNo">
|
||||
<el-input v-model="queryParams.billNo" placeholder="请输入所属入库单据号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option v-for="dict in statusMenu" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="项目ID" prop="projectId">
|
||||
<el-input v-model="queryParams.projectId" placeholder="请输入项目ID" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="RFID编码" prop="rfidCode">
|
||||
<el-input v-model="queryParams.rfidCode" placeholder="请输入RFID编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="打印次数" prop="printCount">
|
||||
<el-input v-model="queryParams.printCount" placeholder="请输入打印次数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="16" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['unique:code:add']">新增</el-button>
|
||||
</el-col> -->
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['unique:code:edit']">修改</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['unique:code:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['unique:code:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="codeList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<!-- <el-table-column label="主键ID" align="center" prop="id" /> -->
|
||||
<el-table-column label="唯一码编号" align="center" prop="code" />
|
||||
<el-table-column label="所属入库单据号" align="center" prop="billNo">
|
||||
<template #default="scope">
|
||||
{{ scope.row.billNo || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="项目ID" align="center" prop="projectId" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
{{ getDictLabel(scope.row.status, statusMenu) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="RFID编码" align="center" prop="rfidCode">
|
||||
<template #default="scope">
|
||||
{{ scope.row.rfidCode || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="打印次数" align="center" prop="printCount" />
|
||||
<el-table-column label="备注" align="center" prop="remark">
|
||||
<template #default="scope">
|
||||
{{ scope.row.remark || '-' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="是否删除" align="center" prop="isDelete" /> -->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['unique:code:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['unique:code: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" />
|
||||
</div>
|
||||
<!-- 添加或修改唯一码管理对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="codeRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="唯一码编号" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入唯一码编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属入库单据号" prop="billNo">
|
||||
<el-input v-model="form.billNo" placeholder="请输入所属入库单据号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目ID" prop="projectId">
|
||||
<el-input v-model="form.projectId" placeholder="请输入项目ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="RFID编码" prop="rfidCode">
|
||||
<el-input v-model="form.rfidCode" placeholder="请输入RFID编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="打印次数" prop="printCount">
|
||||
<el-input v-model="form.printCount" placeholder="请输入打印次数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否删除" prop="isDelete">
|
||||
<el-input v-model="form.isDelete" placeholder="请输入是否删除" />
|
||||
</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="Code">
|
||||
import { listCode, getCode, delCode, addCode, updateCode } from "@/api/unique/code"
|
||||
import { getDictLabel, statusMenu } from '@/utils/until'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const codeList = 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,
|
||||
code: null,
|
||||
billNo: null,
|
||||
projectId: null,
|
||||
status: null,
|
||||
rfidCode: null,
|
||||
printCount: null,
|
||||
isDelete: null
|
||||
},
|
||||
rules: {
|
||||
code: [
|
||||
{ required: true, message: "唯一码编号不能为空", trigger: "blur" }
|
||||
],
|
||||
projectId: [
|
||||
{ required: true, message: "项目ID不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询唯一码管理列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listCode(queryParams.value).then(response => {
|
||||
codeList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
code: null,
|
||||
billNo: null,
|
||||
projectId: null,
|
||||
status: null,
|
||||
rfidCode: null,
|
||||
printCount: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
remark: null,
|
||||
isDelete: null
|
||||
}
|
||||
proxy.resetForm("codeRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加唯一码管理"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getCode(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改唯一码管理"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["codeRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateCode(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addCode(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除唯一码管理编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delCode(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('unique/code/export', {
|
||||
...queryParams.value
|
||||
}, `code_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
288
src/views/worn/inbound/index.vue
Normal file
288
src/views/worn/inbound/index.vue
Normal file
@@ -0,0 +1,288 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form :model="queryParams" class="table-form-search" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="入库单号" prop="billNo">
|
||||
<el-input v-model="queryParams.billNo" placeholder="请输入入库单号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仓库编码" prop="warehouseCode">
|
||||
<el-input v-model="queryParams.warehouseCode" placeholder="请输入仓库编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input v-model="queryParams.warehouseName" placeholder="请输入仓库名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="存储区编码" prop="areaCode">
|
||||
<el-input v-model="queryParams.areaCode" placeholder="请输入存储区编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="存储区名称" prop="areaName">
|
||||
<el-input v-model="queryParams.areaName" placeholder="请输入存储区名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col> -->
|
||||
<el-col :span="8">
|
||||
<el-form-item label="入库时间" prop="inboundTime">
|
||||
<el-date-picker clearable v-model="queryParams.inboundTime" style="width: 100%;" type="date"
|
||||
value-format="YYYY-MM-DD" placeholder="请选择入库时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['worn:inboundBill:add']">新增</el-button>
|
||||
</el-col> -->
|
||||
<!-- <el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['worn:inboundBill:edit']">修改</el-button>
|
||||
</el-col> -->
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:inboundBill:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:inboundBill:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="inboundBillList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="入库单号" align="center" prop="billNo" />
|
||||
<el-table-column label="入库单类型" align="center" prop="billType">
|
||||
<template #default="scope">
|
||||
<span :style="getColor(scope.row.billType, scope.row?.status)">{{ getBillType(scope.row.billType,
|
||||
scope.row?.status, '1')
|
||||
}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
|
||||
<el-table-column label="存储区名称" align="center" prop="areaName" />
|
||||
<el-table-column label="单据备注" align="center" prop="remark" />
|
||||
<el-table-column label="入库时间" align="center" prop="inboundTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.inboundTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<!-- <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:inboundBill:edit']">修改</el-button> -->
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:inboundBill:remove']">删除</el-button>
|
||||
<!-- todo 详情 -->
|
||||
</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" />
|
||||
</div>
|
||||
<!-- 添加或修改入库库存对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form ref="inboundBillRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="入库单号" prop="billNo">
|
||||
<el-input v-model="form.billNo" placeholder="请输入入库单号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库名称" prop="warehouseName">
|
||||
<el-input v-model="form.warehouseName" placeholder="请输入仓库名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="存储区名称" prop="areaName">
|
||||
<el-input v-model="form.areaName" placeholder="请输入存储区名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单据备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="入库时间" prop="inboundTime">
|
||||
<el-date-picker clearable v-model="form.inboundTime" style="width: 100%;" type="date"
|
||||
value-format="YYYY-MM-DD" placeholder="请选择入库时间">
|
||||
</el-date-picker>
|
||||
</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="InboundBill">
|
||||
import { listInboundBill, getInboundBill, delInboundBill, addInboundBill, updateInboundBill } from "@/api/worn/inboundBill"
|
||||
import { getColor, getBillType } from '@/utils/until'
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const inboundBillList = 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,
|
||||
billNo: null,
|
||||
billType: null,
|
||||
warehouseCode: null,
|
||||
warehouseName: null,
|
||||
areaCode: null,
|
||||
areaName: null,
|
||||
inboundTime: null,
|
||||
status: null,
|
||||
isDelete: null,
|
||||
},
|
||||
rules: {
|
||||
billNo: [
|
||||
{ required: true, message: "入库单号不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询入库库存列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listInboundBill(queryParams.value).then(response => {
|
||||
inboundBillList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
billNo: null,
|
||||
billType: null,
|
||||
warehouseCode: null,
|
||||
warehouseName: null,
|
||||
areaCode: null,
|
||||
areaName: null,
|
||||
remark: null,
|
||||
inboundTime: null,
|
||||
status: null,
|
||||
isDelete: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
}
|
||||
proxy.resetForm("inboundBillRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加入库库存"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getInboundBill(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改入库库存"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["inboundBillRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateInboundBill(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addInboundBill(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除入库库存编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delInboundBill(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/inboundBill/export', {
|
||||
...queryParams.value
|
||||
}, `inboundBill_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
414
src/views/worn/index.vue
Normal file
414
src/views/worn/index.vue
Normal file
@@ -0,0 +1,414 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input
|
||||
v-model="queryParams.materialName"
|
||||
placeholder="请输入物料名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料简称" prop="materialShortName">
|
||||
<el-input
|
||||
v-model="queryParams.materialShortName"
|
||||
placeholder="请输入物料简称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input
|
||||
v-model="queryParams.materialCode"
|
||||
placeholder="请输入物料编码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型ID" prop="typeId">
|
||||
<el-input
|
||||
v-model="queryParams.typeId"
|
||||
placeholder="请输入物料类型ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料单位ID" prop="unitId">
|
||||
<el-input
|
||||
v-model="queryParams.unitId"
|
||||
placeholder="请输入物料单位ID"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类别" prop="materialCategory">
|
||||
<el-input
|
||||
v-model="queryParams.materialCategory"
|
||||
placeholder="请输入物料类别"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="公斤转换系数" prop="kgFactor">
|
||||
<el-input
|
||||
v-model="queryParams.kgFactor"
|
||||
placeholder="请输入公斤转换系数"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input
|
||||
v-model="queryParams.specification"
|
||||
placeholder="请输入规格"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="型号" prop="model">
|
||||
<el-input
|
||||
v-model="queryParams.model"
|
||||
placeholder="请输入型号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="条形码" prop="barcode">
|
||||
<el-input
|
||||
v-model="queryParams.barcode"
|
||||
placeholder="请输入条形码"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单件重量(kg)" prop="weight">
|
||||
<el-input
|
||||
v-model="queryParams.weight"
|
||||
placeholder="请输入单件重量(kg)"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="orderNum">
|
||||
<el-input
|
||||
v-model="queryParams.orderNum"
|
||||
placeholder="请输入排序"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑删除" prop="isDelete">
|
||||
<el-input
|
||||
v-model="queryParams.isDelete"
|
||||
placeholder="请输入逻辑删除"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
</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="['worn:material:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['worn:material:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['worn:material:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['worn:material:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="物料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="物料简称" align="center" prop="materialShortName" />
|
||||
<el-table-column label="物料编码" align="center" prop="materialCode" />
|
||||
<el-table-column label="物料类型ID" align="center" prop="typeId" />
|
||||
<el-table-column label="物料单位ID" align="center" prop="unitId" />
|
||||
<el-table-column label="物料类别" align="center" prop="materialCategory" />
|
||||
<el-table-column label="公斤转换系数" align="center" prop="kgFactor" />
|
||||
<el-table-column label="规格" align="center" prop="specification" />
|
||||
<el-table-column label="型号" align="center" prop="model" />
|
||||
<el-table-column label="条形码" align="center" prop="barcode" />
|
||||
<el-table-column label="单件重量(kg)" align="center" prop="weight" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="排序" align="center" prop="orderNum" />
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="逻辑删除" align="center" prop="isDelete" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['worn:material:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['worn:material: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="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料简称" prop="materialShortName">
|
||||
<el-input v-model="form.materialShortName" placeholder="请输入物料简称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input v-model="form.materialCode" placeholder="请输入物料编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类型ID" prop="typeId">
|
||||
<el-input v-model="form.typeId" placeholder="请输入物料类型ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料单位ID" prop="unitId">
|
||||
<el-input v-model="form.unitId" placeholder="请输入物料单位ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="物料类别" prop="materialCategory">
|
||||
<el-input v-model="form.materialCategory" placeholder="请输入物料类别" />
|
||||
</el-form-item>
|
||||
<el-form-item label="公斤转换系数" prop="kgFactor">
|
||||
<el-input v-model="form.kgFactor" placeholder="请输入公斤转换系数" />
|
||||
</el-form-item>
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input v-model="form.specification" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
<el-form-item label="型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入型号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="条形码" prop="barcode">
|
||||
<el-input v-model="form.barcode" placeholder="请输入条形码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单件重量(kg)" prop="weight">
|
||||
<el-input v-model="form.weight" placeholder="请输入单件重量(kg)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="orderNum">
|
||||
<el-input v-model="form.orderNum" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑删除" prop="isDelete">
|
||||
<el-input v-model="form.isDelete" placeholder="请输入逻辑删除" />
|
||||
</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="Material">
|
||||
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial } from "@/api/worn/material"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const materialList = 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,
|
||||
materialName: null,
|
||||
materialShortName: null,
|
||||
materialCode: null,
|
||||
typeId: null,
|
||||
unitId: null,
|
||||
materialCategory: null,
|
||||
kgFactor: null,
|
||||
specification: null,
|
||||
model: null,
|
||||
barcode: null,
|
||||
weight: null,
|
||||
description: null,
|
||||
orderNum: null,
|
||||
status: null,
|
||||
isDelete: null,
|
||||
},
|
||||
rules: {
|
||||
materialName: [
|
||||
{ required: true, message: "物料名称不能为空", trigger: "blur" }
|
||||
],
|
||||
materialCode: [
|
||||
{ required: true, message: "物料编码不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询物料列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMaterial(queryParams.value).then(response => {
|
||||
materialList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
materialName: null,
|
||||
materialShortName: null,
|
||||
materialCode: null,
|
||||
typeId: null,
|
||||
unitId: null,
|
||||
materialCategory: null,
|
||||
kgFactor: null,
|
||||
specification: null,
|
||||
model: null,
|
||||
barcode: null,
|
||||
weight: null,
|
||||
description: null,
|
||||
orderNum: null,
|
||||
status: null,
|
||||
isDelete: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
}
|
||||
proxy.resetForm("materialRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加物料"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getMaterial(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改物料"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["materialRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除物料编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delMaterial(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/material/export', {
|
||||
...queryParams.value
|
||||
}, `material_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
362
src/views/worn/material/index.vue
Normal file
362
src/views/worn/material/index.vue
Normal file
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="queryParams.materialName" placeholder="请输入物料名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料简称" prop="materialShortName">
|
||||
<el-input v-model="queryParams.materialShortName" placeholder="请输入物料简称" clearable
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input v-model="queryParams.materialCode" placeholder="请输入物料编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料类型" prop="typeId">
|
||||
<el-cascader :options="materTypeList" style="width: 100%;" v-model="queryParams.typeId" :props="{
|
||||
children: 'children',
|
||||
label: 'typeName',
|
||||
value: 'id',
|
||||
}" placeholder="请选择物料类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="物料单位" prop="unitId">
|
||||
<el-select v-model="queryParams.unitId" placeholder="请选择物料单位" clearable>
|
||||
<el-option v-for="dict in materUnitList" :key="dict.id" :label="dict.unitName" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['worn:material:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:material:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:material:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="materialList" @selection-change="handleSelectionChange" show-overflow-tooltip
|
||||
border>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="id" width="70" />
|
||||
<el-table-column label="物料名称" align="center" prop="materialName" />
|
||||
<el-table-column label="物料简称" align="center" prop="materialShortName" />
|
||||
<el-table-column label="物料编码" align="center" prop="materialCode" />
|
||||
<el-table-column label="物料单位" align="center" prop="unitName" />
|
||||
<el-table-column label="公斤转换系数" align="center" prop="kgFactor" width="150" />
|
||||
<el-table-column label="物料类别" align="center" prop="typeParentNames" />
|
||||
<el-table-column label="物料类型" align="center" prop="typeName" />
|
||||
<el-table-column label="规格" align="center" prop="specification" />
|
||||
<el-table-column label="型号" align="center" prop="model" />
|
||||
<el-table-column label="条形码" align="center" prop="barcode" />
|
||||
<el-table-column label="重量(kg)" align="center" prop="weight" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="dictTagData()" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:material:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:material: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" />
|
||||
</div>
|
||||
|
||||
<!-- 添加或修改物料对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="1000px" append-to-body>
|
||||
<el-form ref="materialRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料名称" prop="materialName">
|
||||
<el-input v-model="form.materialName" placeholder="请输入物料名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料简称" prop="materialShortName">
|
||||
<el-input v-model="form.materialShortName" placeholder="请输入物料简称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料编码" prop="materialCode">
|
||||
<el-input v-model="form.materialCode" :disabled="true" placeholder="编码代码自动生成" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料类型" prop="typeId">
|
||||
<el-cascader :options="materTypeList" style="width: 100%;" v-model="form.typeId" :props="{
|
||||
children: 'children',
|
||||
label: 'typeName',
|
||||
value: 'id',
|
||||
}" placeholder="请选择物料类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料单位" prop="unitId">
|
||||
<el-select v-model="form.unitId" placeholder="请选择物料单位" clearable>
|
||||
<el-option v-for="dict in materUnitList" :key="dict.id" :label="dict.unitName" :value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格" prop="specification">
|
||||
<el-input v-model="form.specification" placeholder="请输入规格" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="型号" prop="model">
|
||||
<el-input v-model="form.model" placeholder="请输入型号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="条形码" prop="barcode">
|
||||
<el-input v-model="form.barcode" placeholder="请输入条形码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="重量(kg)" prop="weight">
|
||||
<el-input v-model="form.weight" placeholder="请输入单件重量(kg)" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio v-model="form.status" label="0">启用</el-radio>
|
||||
<el-radio v-model="form.status" label="1">停用</el-radio>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</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="Material">
|
||||
import { listMaterial, getMaterial, delMaterial, addMaterial, updateMaterial, getMaterTypeTree } from "@/api/worn/material"
|
||||
import { listUnit } from "@/api/worn/unit"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const ids = ref([])
|
||||
const materialList = ref([])
|
||||
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const multiple = ref(true)
|
||||
const showSearch = ref(true)
|
||||
|
||||
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
materialName: null,
|
||||
materialShortName: null,
|
||||
materialCode: null,
|
||||
typeId: null,
|
||||
unitId: null,
|
||||
},
|
||||
rules: {
|
||||
materialName: [
|
||||
{ required: true, message: "物料名称不能为空", trigger: "blur" }
|
||||
],
|
||||
typeId: [
|
||||
{ required: true, message: "物料类型不能为空", trigger: "blur" }
|
||||
],
|
||||
unitId: [
|
||||
{ required: true, message: "物料单位不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询物料列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMaterial(queryParams.value).then(response => {
|
||||
materialList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
materialName: null,
|
||||
materialShortName: null,
|
||||
materialCode: null,
|
||||
typeId: null,
|
||||
unitId: null,
|
||||
}
|
||||
proxy.resetForm("materialRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
if (queryParams.value.typeId) {
|
||||
queryParams.value.typeId = queryParams.value.typeId[queryParams.value.typeId.length - 1]
|
||||
}
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加物料"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getMaterial(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改物料"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["materialRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
form.value.typeId = form.value.typeId[form.value.typeId.length - 1]
|
||||
updateMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
form.value.typeId = form.value.typeId[form.value.typeId.length - 1]
|
||||
addMaterial(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除物料编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delMaterial(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/material/export', {
|
||||
...queryParams.value
|
||||
}, `物料管理_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
// 物料类型下拉获取相关
|
||||
const materTypeList = ref([]);
|
||||
function getMaterTypeTreeFun() {
|
||||
getMaterTypeTree().then((response) => {
|
||||
materTypeList.value = response.data;
|
||||
});
|
||||
}
|
||||
getMaterTypeTreeFun();
|
||||
|
||||
// 物料单位
|
||||
const materUnitList = ref([]);
|
||||
function getMaterUnitFn() {
|
||||
listUnit().then((res) => {
|
||||
materUnitList.value = res.rows;
|
||||
})
|
||||
}
|
||||
getMaterUnitFn();
|
||||
// 物资类型状态 (0正常1停用) - 状态按钮暂未显示
|
||||
const statusList = ref([
|
||||
{ value: 0, label: "启用", elTagType: "success", elTagClass: null },
|
||||
{ value: 1, label: "停用", elTagType: "warning", elTagClass: null }
|
||||
]);
|
||||
const dictTagData = () => {
|
||||
return statusList.value.map((item) => ({
|
||||
...item,
|
||||
value: String(item.value),
|
||||
}));
|
||||
};
|
||||
getList()
|
||||
</script>
|
||||
258
src/views/worn/mqttCommand/index.vue
Normal file
258
src/views/worn/mqttCommand/index.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="queryParams.deviceId" placeholder="请输入设备ID" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="下发Topic" prop="topic">
|
||||
<el-input v-model="queryParams.topic" placeholder="请输入下发Topic" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['worn:mqttCommand:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['worn:mqttCommand:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:mqttCommand:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:mqttCommand:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="mqttCommandList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="设备ID" align="center" prop="deviceId" />
|
||||
<el-table-column label="下发Topic" align="center" prop="topic" show-overflow-tooltip width="200" />
|
||||
<el-table-column label="指令类型" align="center" prop="command" />
|
||||
<el-table-column label="指令JSON" align="center" prop="payload" show-overflow-tooltip width="200"/>
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="发送时间" align="center" prop="sendTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.sendTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:mqttCommand:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:mqttCommand: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" />
|
||||
</div>
|
||||
<!-- 添加或修改指令管理对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form ref="mqttCommandRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" placeholder="请输入设备ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="下发Topic" prop="topic">
|
||||
<el-input v-model="form.topic" placeholder="请输入下发Topic" />
|
||||
</el-form-item>
|
||||
<el-form-item label="指令类型" prop="command">
|
||||
<el-input v-model="form.command" placeholder="请输入指令类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="指令JSON" prop="payload">
|
||||
<el-input v-model="form.payload" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="发送时间" prop="sendTime">
|
||||
<el-date-picker clearable v-model="form.sendTime" type="date" style="width: 100%;" value-format="YYYY-MM-DD" placeholder="请选择发送时间">
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标识" prop="isDelete">
|
||||
<el-input v-model="form.isDelete" placeholder="请输入删除标识" />
|
||||
</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="MqttCommand">
|
||||
import { listMqttCommand, getMqttCommand, delMqttCommand, addMqttCommand, updateMqttCommand } from "@/api/worn/mqttCommand"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const mqttCommandList = 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,
|
||||
deviceId: null,
|
||||
topic: null,
|
||||
command: null,
|
||||
payload: null,
|
||||
status: null,
|
||||
sendTime: null,
|
||||
isDelete: null
|
||||
},
|
||||
rules: {
|
||||
deviceId: [
|
||||
{ required: true, message: "设备ID不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询指令管理列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMqttCommand(queryParams.value).then(response => {
|
||||
mqttCommandList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
deviceId: null,
|
||||
topic: null,
|
||||
command: null,
|
||||
payload: null,
|
||||
status: null,
|
||||
sendTime: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
isDelete: null
|
||||
}
|
||||
proxy.resetForm("mqttCommandRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加指令管理"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getMqttCommand(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改指令管理"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["mqttCommandRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateMqttCommand(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addMqttCommand(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除指令管理编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delMqttCommand(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/mqttCommand/export', {
|
||||
...queryParams.value
|
||||
}, `mqttCommand_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
337
src/views/worn/mqttConfig/index.vue
Normal file
337
src/views/worn/mqttConfig/index.vue
Normal file
@@ -0,0 +1,337 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch"
|
||||
label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目编码" prop="project">
|
||||
<el-input v-model="queryParams.project" placeholder="请输入项目编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仓库编码" prop="warehouse">
|
||||
<el-input v-model="queryParams.warehouse" placeholder="请输入仓库编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="上行 Topic" prop="topicUp">
|
||||
<el-input v-model="queryParams.topicUp" placeholder="请输入上行 Topic" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="下行 Topic" prop="topicDownPrefix">
|
||||
<el-input v-model="queryParams.topicDownPrefix" placeholder="请输入下行 Topic" clearable
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="所属部门" prop="deptId">
|
||||
<DepartmentCascaDer v-model="queryParams.deptId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||
<el-option label="启用" value="0" />
|
||||
<el-option label="停用" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['worn:mqttConfig:add']">
|
||||
新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['worn:mqttConfig:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:mqttConfig:remove']">
|
||||
删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['worn:mqttConfig:export']">
|
||||
导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="mqttConfigList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="项目编码" align="center" prop="project" />
|
||||
<el-table-column label="仓库编码" align="center" prop="warehouse" />
|
||||
|
||||
<el-table-column label="所属部门" align="center" prop="deptId">
|
||||
<template #default="scope">
|
||||
{{ getDictLabel(scope.row.deptId, departmentList, { name: 'deptName', value: 'deptId' }) }}
|
||||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column label="上行 Topic" align="center" prop="topicUp" min-width="220" show-overflow-tooltip />
|
||||
<el-table-column label="下行 Topic" align="center" prop="topicDownPrefix" min-width="240" show-overflow-tooltip />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === '0' ? 'success' : 'info'">
|
||||
{{ scope.row.status === '0' ? '启用' : '停用' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" min-width="100">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:mqttConfig:edit']">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:mqttConfig: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" />
|
||||
</div>
|
||||
|
||||
<el-dialog :title="title" v-model="open" width="800px" append-to-body>
|
||||
<el-form ref="mqttConfigRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="项目编码" prop="project">
|
||||
<el-input v-model="form.project" placeholder="请输入项目编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="仓库编码" prop="warehouse">
|
||||
<el-input v-model="form.warehouse" placeholder="请输入仓库编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属部门" prop="deptId">
|
||||
<DepartmentCascaDer v-model="form.deptId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio value="0">启用</el-radio>
|
||||
<el-radio value="1">停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="上行 Topic" prop="topicUp">
|
||||
<el-input v-model="form.topicUp" placeholder="请输入上行 Topic" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="下行 Topic" prop="topicDownPrefix">
|
||||
<el-input v-model="form.topicDownPrefix" placeholder="请输入下行 Topic" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</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="MqttConfig">
|
||||
import { listDept } from '@/api/system/dept'
|
||||
import { getDictLabel, getDeptIdPath } from '@/utils/until'
|
||||
import { addMqttConfig, delMqttConfig, getMqttConfig, listMqttConfig, updateMqttConfig } from "@/api/worn/mqttConfig"
|
||||
import DepartmentCascaDer from '../../../components/DepartmentCascaDer/index.vue'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const ids = ref([])
|
||||
const mqttConfigList = ref([])
|
||||
const departmentList = ref([]);
|
||||
|
||||
const open = ref(false)
|
||||
const single = ref(true)
|
||||
const loading = ref(true)
|
||||
const multiple = ref(true)
|
||||
const showSearch = ref(true)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
project: null,
|
||||
warehouse: null,
|
||||
deptId: null,
|
||||
topicUp: null,
|
||||
topicDownPrefix: null,
|
||||
status: null
|
||||
},
|
||||
rules: {
|
||||
project: [{ required: true, message: "项目编码不能为空", trigger: "blur" }],
|
||||
warehouse: [{ required: true, message: "仓库编码不能为空", trigger: "blur" }],
|
||||
topicUp: [{ required: true, message: "上行 Topic 不能为空", trigger: "blur" }],
|
||||
topicDownPrefix: [{ required: true, message: "下行 Topic不能为空", trigger: "blur" }],
|
||||
status: [{ required: true, message: "状态不能为空", trigger: "change" }]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
|
||||
function getDepartmentListFun() {
|
||||
listDept().then((response) => {
|
||||
departmentList.value = response.data
|
||||
});
|
||||
}
|
||||
getDepartmentListFun()
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMqttConfig(queryParams.value).then(response => {
|
||||
mqttConfigList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
}).catch(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
project: null,
|
||||
warehouse: null,
|
||||
deptId: null,
|
||||
topicUp: null,
|
||||
topicDownPrefix: null,
|
||||
status: "0",
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
isDelete: "0"
|
||||
}
|
||||
proxy.resetForm("mqttConfigRef")
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
if (queryParams.value.deptId) {
|
||||
queryParams.value.deptId = queryParams.value.deptId.at(-1)
|
||||
}
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length !== 1
|
||||
multiple.value = selection.length === 0
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "新增 MQTT 主题配置"
|
||||
}
|
||||
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const currentId = row?.id || ids.value[0]
|
||||
getMqttConfig(currentId).then(response => {
|
||||
const department = proxy.handleTree(departmentList.value, "deptId")
|
||||
const deptId = getDeptIdPath(department, response.data.deptId)
|
||||
form.value = { ...response.data, deptId }
|
||||
if (!form.value.status) {
|
||||
form.value.status = "0"
|
||||
}
|
||||
open.value = true
|
||||
title.value = "修改 MQTT 主题配置"
|
||||
})
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
proxy.$refs["mqttConfigRef"].validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
form.value = { ...form.value, deptId: form.value.deptId.at(-1) }
|
||||
const request = form.value.id != null ? updateMqttConfig(form.value) : addMqttConfig(form.value)
|
||||
request.then(() => {
|
||||
proxy.$modal.msgSuccess(form.value.id != null ? "修改成功" : "新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
const currentIds = row?.id || ids.value
|
||||
proxy.$modal.confirm(`是否确认删除 MQTT 主题配置编号为 "${currentIds}" 的数据项?`).then(() => {
|
||||
return delMqttConfig(currentIds)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download("worn/mqttConfig/export", {
|
||||
...queryParams.value
|
||||
}, `mqttConfig_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
329
src/views/worn/mqttData/index.vue
Normal file
329
src/views/worn/mqttData/index.vue
Normal file
@@ -0,0 +1,329 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form :model="queryParams" class="table-form-search" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="项目" prop="project">
|
||||
<el-input v-model="queryParams.project" placeholder="请输入项目" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="仓库" prop="warehouse">
|
||||
<el-input v-model="queryParams.warehouse" placeholder="请输入仓库" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['worn:mqttData:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['worn:mqttData:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:mqttData:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:mqttData:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="mqttDataList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="设备ID" align="center" prop="deviceId" />
|
||||
<el-table-column label="MQTT Topic" align="center" prop="topic" min-width="180" show-overflow-tooltip />
|
||||
<el-table-column label="项目" align="center" prop="project" min-width="100" show-overflow-tooltip />
|
||||
<el-table-column label="仓库" align="center" prop="warehouse" />
|
||||
<el-table-column label="原始消息" align="center" prop="payload" min-width="300" show-overflow-tooltip />
|
||||
<el-table-column label="解析JSON" align="center" prop="dataJson" min-width="300" show-overflow-tooltip />
|
||||
<el-table-column label="电量" align="center" prop="battery">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.battery !== null && scope.row.battery !== undefined && scope.row.battery !== ''"
|
||||
color="#409EFF" style="color: #fff;">{{ scope.row.battery }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="温度" align="center" prop="temperature">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
v-if="scope.row.temperature !== null && scope.row.temperature !== undefined && scope.row.temperature !== ''"
|
||||
color="#E6A23C" style="color: #fff;">{{ scope.row.temperature }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="湿度" align="center" prop="humidity">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.humidity !== null && scope.row.humidity !== undefined && scope.row.humidity !== ''"
|
||||
color="#00B5D8" style="color: #fff;">{{ scope.row.humidity }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="氨气" align="center" prop="nh3">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.nh3 !== null && scope.row.nh3 !== undefined && scope.row.nh3 !== ''" color="#9C27B0"
|
||||
style="color: #fff;">{{ scope.row.nh3 }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="硫化氢" align="center" prop="h2s">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.h2s !== null && scope.row.h2s !== undefined && scope.row.h2s !== ''" color="#EC407A"
|
||||
style="color: #fff;">{{ scope.row.h2s }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="烟雾浓度" align="center" prop="concentration">
|
||||
<template #default="scope">
|
||||
<el-tag color="#607D8B" style="color: #fff;">{{ scope.row.concentration ?? 0 }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="水位状态" align="center" prop="waterStatus">
|
||||
<template #default="scope">
|
||||
<el-tag
|
||||
:type="(scope.row.waterStatus === null || scope.row.waterStatus === undefined || scope.row.waterStatus === '' || scope.row.waterStatus === 0) ? 'success' : 'danger'">
|
||||
{{ (scope.row.waterStatus === null || scope.row.waterStatus === undefined || scope.row.waterStatus === ''
|
||||
||
|
||||
scope.row.waterStatus === 0) ? '正常' : '报警' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="删除标识" align="center" prop="isDelete" />-->
|
||||
<el-table-column label="操作" align="center" fixed="right" width="150">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:mqttData:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:mqttData: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" />
|
||||
</div>
|
||||
<!-- 添加或修改设备数据对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body>
|
||||
<el-form ref="mqttDataRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" placeholder="请输入设备ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="MQTT Topic" prop="topic">
|
||||
<el-input v-model="form.topic" placeholder="请输入MQTT Topic" />
|
||||
</el-form-item>
|
||||
<el-form-item label="项目" prop="project">
|
||||
<el-input v-model="form.project" placeholder="请输入项目" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仓库" prop="warehouse">
|
||||
<el-input v-model="form.warehouse" placeholder="请输入仓库" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原始消息" prop="payload">
|
||||
<el-input v-model="form.payload" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="解析JSON" prop="dataJson">
|
||||
<el-input v-model="form.dataJson" type="textarea" placeholder="请输入内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="电量" prop="battery">
|
||||
<el-input v-model="form.battery" placeholder="请输入电量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="温度" prop="temperature">
|
||||
<el-input v-model="form.temperature" placeholder="请输入温度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="湿度" prop="humidity">
|
||||
<el-input v-model="form.humidity" placeholder="请输入湿度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="氨气" prop="nh3">
|
||||
<el-input v-model="form.nh3" placeholder="请输入氨气" />
|
||||
</el-form-item>
|
||||
<el-form-item label="硫化氢" prop="h2s">
|
||||
<el-input v-model="form.h2s" placeholder="请输入硫化氢" />
|
||||
</el-form-item>
|
||||
<el-form-item label="烟雾浓度" prop="concentration">
|
||||
<el-input v-model="form.concentration" placeholder="请输入烟雾浓度" />
|
||||
</el-form-item>
|
||||
<el-form-item label="水位状态" prop="waterStatus">
|
||||
<el-select v-model="form.waterStatus" placeholder="请选择水位状态">
|
||||
<el-option label="正常" :value="0" />
|
||||
<el-option label="报警" :value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="删除标识" prop="isDelete">
|
||||
<el-input v-model="form.isDelete" placeholder="请输入删除标识" />
|
||||
</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="MqttData">
|
||||
import { listMqttData, getMqttData, delMqttData, addMqttData, updateMqttData } from "@/api/worn/mqttData"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const mqttDataList = 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,
|
||||
project: null,
|
||||
warehouse: null
|
||||
},
|
||||
rules: {
|
||||
deviceId: [
|
||||
{ required: true, message: "设备ID不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询设备数据列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMqttData(queryParams.value).then(response => {
|
||||
mqttDataList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
deviceId: null,
|
||||
topic: null,
|
||||
project: null,
|
||||
warehouse: null,
|
||||
payload: null,
|
||||
dataJson: null,
|
||||
battery: null,
|
||||
temperature: null,
|
||||
humidity: null,
|
||||
nh3: null,
|
||||
h2s: null,
|
||||
concentration: null,
|
||||
waterStatus: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
isDelete: null
|
||||
}
|
||||
proxy.resetForm("mqttDataRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加设备数据"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getMqttData(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改设备数据"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["mqttDataRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateMqttData(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addMqttData(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除设备数据编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delMqttData(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/mqttData/export', {
|
||||
...queryParams.value
|
||||
}, `mqttData_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
328
src/views/worn/mqttDevice/index.vue
Normal file
328
src/views/worn/mqttDevice/index.vue
Normal file
@@ -0,0 +1,328 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="100px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备唯一标识" prop="devEui">
|
||||
<el-input v-model="queryParams.devEui" placeholder="请输入设备唯一标识" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="所属部门" prop="deptId">
|
||||
<DepartmentCascaDer v-model="queryParams.deptId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="queryParams.deviceName" placeholder="请输入设备名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24" class="searchBtn">
|
||||
<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-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['worn:mqttDevice:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['worn:mqttDevice:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:mqttDevice:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:mqttDevice:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="mqttDeviceList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="设备唯一标识" align="center" prop="devEui" />
|
||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||
<el-table-column label="设备类型" align="center" prop="deviceType" />
|
||||
<el-table-column label="上报周期(分钟)" align="center" prop="reportIntervalMinute" />
|
||||
<el-table-column label="所属部门" align="center" prop="deptId">
|
||||
<template #default="scope">
|
||||
{{ getDictLabel(scope.row.deptId, departmentList, { name: 'deptName', value: 'deptId' }) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<el-tag v-if="scope.row.status === '0'" type="success">正常</el-tag>
|
||||
<el-tag v-else-if="scope.row.status === '1'" type="danger">不可用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:mqttDevice:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:mqttDevice: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" />
|
||||
</div>
|
||||
<!-- 添加或修改MQTT设备对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="700px" append-to-body>
|
||||
<el-form ref="mqttDeviceRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备唯一标识" prop="devEui">
|
||||
<el-input v-model="form.devEui" placeholder="请输入设备唯一标识" :disabled="isEdit" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备名称" prop="deviceName">
|
||||
<el-input v-model="form.deviceName" placeholder="请输入设备名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备类型" prop="deviceType">
|
||||
<el-input v-model="form.deviceType" placeholder="请输入设备类型" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属部门" prop="deptId">
|
||||
<DepartmentCascaDer v-model="form.deptId" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="上报周期(分钟)" prop="reportIntervalMinute">
|
||||
<el-input-number
|
||||
v-model="form.reportIntervalMinute"
|
||||
:min="1"
|
||||
:max="1440"
|
||||
controls-position="right"
|
||||
placeholder="请输入上报周期"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12"></el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</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="MqttDevice">
|
||||
import { listDept } from '@/api/system/dept'
|
||||
import { getDictLabel, getDeptIdPath } from '@/utils/until'
|
||||
import DepartmentCascaDer from '../../../components/DepartmentCascaDer/index.vue'
|
||||
import { listMqttDevice, getMqttDevice, delMqttDevice, addMqttDevice, updateMqttDevice } from "@/api/worn/mqttDevice";
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const ids = ref([])
|
||||
const mqttDeviceList = ref([])
|
||||
|
||||
const open = ref(false)
|
||||
const isEdit = ref(false)
|
||||
const single = ref(true)
|
||||
const loading = ref(true)
|
||||
const multiple = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const departmentList = ref([]);// 所属部门
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
devEui: null,
|
||||
deviceName: null,
|
||||
deviceType: null,
|
||||
reportIntervalMinute: null,
|
||||
deptId: null,
|
||||
status: null
|
||||
},
|
||||
rules: {
|
||||
devEui: [
|
||||
{ required: true, message: "设备唯一标识不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
// 所属部门
|
||||
function getDepartmentListFun() {
|
||||
listDept().then((response) => {
|
||||
departmentList.value = response.data
|
||||
|
||||
});
|
||||
}
|
||||
getDepartmentListFun()
|
||||
|
||||
|
||||
/** 查询MQTT设备列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMqttDevice(queryParams.value).then(response => {
|
||||
mqttDeviceList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
devEui: null,
|
||||
deviceName: null,
|
||||
deviceType: null,
|
||||
reportIntervalMinute: null,
|
||||
deptId: null,
|
||||
status: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
}
|
||||
proxy.resetForm("mqttDeviceRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
console.log(queryParams.value.deptId, 'queryParams.value.deptId');
|
||||
|
||||
if (queryParams.value.deptId) {
|
||||
queryParams.value.deptId = queryParams.value.deptId.at(-1)
|
||||
}
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
isEdit.value = false
|
||||
open.value = true
|
||||
title.value = "添加MQTT设备"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
|
||||
reset()
|
||||
isEdit.value = true
|
||||
const _id = row.id || ids.value
|
||||
getMqttDevice(_id).then(response => {
|
||||
const department = proxy.handleTree(departmentList.value, "deptId")
|
||||
const deptId = getDeptIdPath(department, response.data.deptId)
|
||||
form.value = { ...response.data, deptId }
|
||||
open.value = true
|
||||
title.value = "修改MQTT设备"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["mqttDeviceRef"].validate(valid => {
|
||||
if (valid) {
|
||||
form.value = { ...form.value, deptId: form.value.deptId.at(-1) }
|
||||
if (form.value.id != null) {
|
||||
updateMqttDevice(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addMqttDevice(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除MQTT设备编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delMqttDevice(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/mqttDevice/export', {
|
||||
...queryParams.value
|
||||
}, `mqttDevice_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
:deep(.el-form-item__label) {
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
254
src/views/worn/mqttEvent/index.vue
Normal file
254
src/views/worn/mqttEvent/index.vue
Normal file
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="queryParams.deviceId" placeholder="请输入设备ID" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="等级" prop="level">
|
||||
<el-select v-model="queryParams.level" placeholder="请选择等级" clearable>
|
||||
<el-option v-for="dict in levelTypeMenu" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['worn:mqttEvent:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['worn:mqttEvent:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:mqttEvent:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:mqttEvent:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="mqttEventList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="设备ID" align="center" prop="deviceId" />
|
||||
<el-table-column label="事件类型" align="center" prop="eventType" />
|
||||
<el-table-column label="事件描述" align="center" prop="eventDesc" />
|
||||
<el-table-column label="等级" align="center" prop="level">
|
||||
<template #default="scope">
|
||||
{{ getDictLabel(scope.row.level, levelTypeMenu) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="处理状态" align="center" prop="status" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="删除标识" align="center" prop="isDelete" /> -->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:mqttEvent:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:mqttEvent: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" />
|
||||
</div>
|
||||
<!-- 添加或修改设备事件对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="mqttEventRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" placeholder="请输入设备ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="事件描述" prop="eventDesc">
|
||||
<el-input v-model="form.eventDesc" placeholder="请输入事件描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="等级" prop="level">
|
||||
<el-select v-model="form.level" placeholder="请选择等级" clearable>
|
||||
<el-option v-for="dict in levelTypeMenu" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</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="MqttEvent">
|
||||
import { listMqttEvent, getMqttEvent, delMqttEvent, addMqttEvent, updateMqttEvent } from "@/api/worn/mqttEvent"
|
||||
import { levelTypeMenu, getDictLabel } from '@/utils/until'
|
||||
const { proxy } = getCurrentInstance()
|
||||
console.log(levelTypeMenu, 'levelTypeMenu');
|
||||
|
||||
const mqttEventList = 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,
|
||||
deviceId: null,
|
||||
eventType: null,
|
||||
eventDesc: null,
|
||||
level: null,
|
||||
status: null,
|
||||
isDelete: null
|
||||
},
|
||||
rules: {
|
||||
deviceId: [
|
||||
{ required: true, message: "设备ID不能为空", trigger: "blur" }
|
||||
],
|
||||
eventType: [
|
||||
{ required: true, message: "事件类型不能为空", trigger: "change" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询设备事件列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listMqttEvent(queryParams.value).then(response => {
|
||||
mqttEventList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
deviceId: null,
|
||||
eventType: null,
|
||||
eventDesc: null,
|
||||
level: null,
|
||||
status: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
isDelete: null
|
||||
}
|
||||
proxy.resetForm("mqttEventRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加设备事件"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getMqttEvent(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改设备事件"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["mqttEventRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateMqttEvent(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addMqttEvent(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除设备事件编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delMqttEvent(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/mqttEvent/export', {
|
||||
...queryParams.value
|
||||
}, `mqttEvent_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
261
src/views/worn/threshold/index.vue
Normal file
261
src/views/worn/threshold/index.vue
Normal file
@@ -0,0 +1,261 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="queryParams.deviceId" placeholder="请输入设备ID" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div class="table-list">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['worn:threshold:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['worn:threshold:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:threshold:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:threshold:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="thresholdList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="主键ID" align="center" prop="id" />
|
||||
<el-table-column label="设备ID" align="center" prop="deviceId" />
|
||||
<el-table-column label="指标类型" align="center" prop="metricType" />
|
||||
<el-table-column label="预警最小值" align="center" prop="warnMin" />
|
||||
<el-table-column label="预警最大值" align="center" prop="warnMax" />
|
||||
<el-table-column label="报警最小值" align="center" prop="alarmMin" />
|
||||
<el-table-column label="报警最大值" align="center" prop="alarmMax" />
|
||||
<el-table-column label="单位" align="center" prop="unit" />
|
||||
<el-table-column label="状态" align="center" prop="status" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<!-- <el-table-column label="是否删除" align="center" prop="isDelete" /> -->
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:threshold:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:threshold: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" />
|
||||
</div>
|
||||
<!-- 添加或修改传感器阈值配置对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="thresholdRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="设备ID" prop="deviceId">
|
||||
<el-input v-model="form.deviceId" placeholder="请输入设备ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预警最小值" prop="warnMin">
|
||||
<el-input v-model="form.warnMin" placeholder="请输入预警最小值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预警最大值" prop="warnMax">
|
||||
<el-input v-model="form.warnMax" placeholder="请输入预警最大值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="报警最小值" prop="alarmMin">
|
||||
<el-input v-model="form.alarmMin" placeholder="请输入报警最小值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="报警最大值" prop="alarmMax">
|
||||
<el-input v-model="form.alarmMax" placeholder="请输入报警最大值" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位" prop="unit">
|
||||
<el-input v-model="form.unit" placeholder="请输入单位" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="是否删除" prop="isDelete">
|
||||
<el-input v-model="form.isDelete" placeholder="请输入是否删除" />
|
||||
</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="Threshold">
|
||||
import { listThreshold, getThreshold, delThreshold, addThreshold, updateThreshold } from "@/api/worn/threshold"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const thresholdList = 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,
|
||||
deviceId: null,
|
||||
metricType: null,
|
||||
warnMin: null,
|
||||
warnMax: null,
|
||||
alarmMin: null,
|
||||
alarmMax: null,
|
||||
unit: null,
|
||||
status: null,
|
||||
isDelete: null
|
||||
},
|
||||
rules: {
|
||||
deviceId: [
|
||||
{ required: true, message: "设备ID不能为空", trigger: "blur" }
|
||||
],
|
||||
metricType: [
|
||||
{ required: true, message: "指标类型不能为空", trigger: "change" }
|
||||
],
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询传感器阈值配置列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listThreshold(queryParams.value).then(response => {
|
||||
thresholdList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
deviceId: null,
|
||||
metricType: null,
|
||||
warnMin: null,
|
||||
warnMax: null,
|
||||
alarmMin: null,
|
||||
alarmMax: null,
|
||||
unit: null,
|
||||
status: null,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
isDelete: null
|
||||
}
|
||||
proxy.resetForm("thresholdRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
single.value = selection.length != 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加传感器阈值配置"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getThreshold(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改传感器阈值配置"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["thresholdRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateThreshold(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
addThreshold(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除传感器阈值配置编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delThreshold(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/threshold/export', {
|
||||
...queryParams.value
|
||||
}, `threshold_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
262
src/views/worn/type/index.vue
Normal file
262
src/views/worn/type/index.vue
Normal file
@@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="90px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="编码" prop="typeCode">
|
||||
<el-input v-model="queryParams.typeCode" placeholder="请输入编码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="名称" prop="typeName">
|
||||
<el-input v-model="queryParams.typeName" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="首字母代码" prop="firstLetter">
|
||||
<el-input v-model="queryParams.firstLetter" placeholder="请输入首字母代码" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="queryParams.description" placeholder="请输入描述" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="16" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div class="table-list">
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd(null)"
|
||||
v-hasPermi="['worn:type:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:type:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:type:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange" default-expand-all
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }" row-key="id" border>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="编码" align="center" prop="typeCode" />
|
||||
<el-table-column label="名称" align="center" prop="typeName" />
|
||||
<el-table-column label="首字母代码" align="center" prop="firstLetter" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Plus" @click="handleAdd(scope.row)" v-hasPermi="['worn:type:add']"
|
||||
v-if="scope.row.level < 3">新增</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:type:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:type: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" />
|
||||
</div>
|
||||
|
||||
<!-- 添加或修改废旧系统物料类型对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="600px" append-to-body destroy-on-close>
|
||||
<el-form ref="typeRef" :model="form" :rules="rules" label-width="90px">
|
||||
<div v-if="optionType != 0">
|
||||
<el-form-item label="上级类型" prop="parentTypeName">
|
||||
<el-input v-model="form.parentTypeName" :disabled="true" placeholder="请输入上级类型" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item label="名称" prop="typeName">
|
||||
<el-input v-model="form.typeName" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="编码" prop="typeCode">
|
||||
<el-input v-model="form.typeCode" :disabled="true" placeholder="编码代码自动生成" />
|
||||
</el-form-item>
|
||||
<el-form-item label="首字母代码" prop="firstLetter">
|
||||
<el-input v-model="form.firstLetter" :disabled="true" placeholder="首字母代码自动生成" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入描述" />
|
||||
</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="Type">
|
||||
import { listType, getType, delType, addType, updateType } from "@/api/worn/type"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const multiple = ref(true)
|
||||
const showSearch = ref(true)
|
||||
|
||||
const ids = ref([])
|
||||
const typeList = ref([])
|
||||
|
||||
const total = ref(0)
|
||||
const optionType = ref(0) //0新增 1修改 2子级新增
|
||||
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeCode: null,
|
||||
typeName: null,
|
||||
firstLetter: null,
|
||||
description: null,
|
||||
},
|
||||
rules: {
|
||||
typeName: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
/** 查询废旧系统物料类型(支持父子级树结构)列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
typeList.value = []
|
||||
listType(queryParams.value).then(response => {
|
||||
typeList.value = proxy.handleTree(response.rows, "id")
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
typeCode: null,
|
||||
typeName: null,
|
||||
firstLetter: null,
|
||||
description: null,
|
||||
}
|
||||
proxy.resetForm("typeRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd(row) {
|
||||
reset()
|
||||
// 存在row值 则为子级增加 type为2 存在父级类型栏位
|
||||
if (row) {
|
||||
form.value = { parentTypeName: row.typeName, parentId: row.id }
|
||||
optionType.value = 2
|
||||
} else {
|
||||
optionType.value = 0
|
||||
}
|
||||
open.value = true
|
||||
title.value = "添加物料类型"
|
||||
}
|
||||
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getType(_id).then(response => {
|
||||
form.value = { ...response.data, parentTypeName: response.data.typeName }
|
||||
optionType.value = 1
|
||||
open.value = true
|
||||
title.value = "修改物料类型"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["typeRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateType(form.value).then(response => {
|
||||
console.log(response, 'response');
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
} else {
|
||||
if (optionType.value == 2) {
|
||||
delete form.value.parentTypeName
|
||||
}
|
||||
addType(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除废旧系统物料类型编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delType(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/type/export', {
|
||||
...queryParams.value
|
||||
}, `物料类型_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
235
src/views/worn/unit/index.vue
Normal file
235
src/views/worn/unit/index.vue
Normal file
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<div class="app-container-page">
|
||||
<el-form class="table-form-search" :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
||||
label-width="68px">
|
||||
<el-row>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="名称" prop="unitName">
|
||||
<el-input v-model="queryParams.unitName" placeholder="请输入名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="queryParams.description" placeholder="请输入描述" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8" class="searchBtn">
|
||||
<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-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<div class="table-list">
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['worn:unit:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['worn:unit:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['worn:unit:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="序号" align="center" prop="id" />
|
||||
<el-table-column label="名称" align="center" prop="unitName" />
|
||||
<el-table-column label="描述" align="center" prop="description" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['worn:unit:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['worn:unit: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" />
|
||||
</div>
|
||||
|
||||
<!-- 添加或修改物料单位对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
<el-form ref="unitRef" :model="form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="名称" prop="unitName">
|
||||
<el-input v-model="form.unitName" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入描述" />
|
||||
</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="Unit">
|
||||
import { listUnit, getUnit, delUnit, addUnit, updateUnit } from "@/api/worn/unit"
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
|
||||
const open = ref(false)
|
||||
const loading = ref(true)
|
||||
const multiple = ref(true)
|
||||
const showSearch = ref(true)
|
||||
|
||||
const ids = ref([])
|
||||
const unitList = ref([])
|
||||
|
||||
const total = ref(0)
|
||||
const title = ref("")
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
unitName: null,
|
||||
description: null,
|
||||
orderNum: null,
|
||||
status: null,
|
||||
isDelete: null,
|
||||
},
|
||||
rules: {
|
||||
unitName: [
|
||||
{ required: true, message: "名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
})
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
/** 查询物料单位列表 */
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listUnit(queryParams.value).then(response => {
|
||||
unitList.value = response.rows
|
||||
total.value = response.total
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
unitName: null,
|
||||
description: null,
|
||||
orderNum: null,
|
||||
status: null,
|
||||
isDelete: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null
|
||||
}
|
||||
proxy.resetForm("unitRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef")
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id)
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = "添加单位"
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset()
|
||||
const _id = row.id || ids.value
|
||||
getUnit(_id).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = "修改单位"
|
||||
})
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["unitRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateUnit(form.value).then(response => {
|
||||
console.log(response, 'response')
|
||||
if (`${response.code}` == '200') {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
getList()
|
||||
} else {
|
||||
proxy.$modal.msgError('操作失败')
|
||||
}
|
||||
|
||||
})
|
||||
} else {
|
||||
addUnit(form.value).then(response => {
|
||||
if (`${response.code}` == '200') {
|
||||
proxy.$modal.msgSuccess("新增成功")
|
||||
open.value = false
|
||||
getList()
|
||||
} else {
|
||||
proxy.$modal.msgError('操作失败')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value
|
||||
proxy.$modal.confirm('是否确认删除单位编号为"' + _ids + '"的数据项?').then(function () {
|
||||
return delUnit(_ids)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('worn/unit/export', {
|
||||
...queryParams.value
|
||||
}, `物料单位_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
1413
src/views/worn/warehouseDashboard/index.vue
Normal file
1413
src/views/worn/warehouseDashboard/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
@@ -42,7 +42,7 @@ export default defineConfig(({ mode, command }) => {
|
||||
},
|
||||
// vite 相关配置
|
||||
server: {
|
||||
port: 80,
|
||||
port: 5173,
|
||||
host: true,
|
||||
open: true,
|
||||
proxy: {
|
||||
|
||||
Reference in New Issue
Block a user