设备维修功能完成

This commit is contained in:
liub
2025-09-03 14:16:47 +08:00
parent 1eeb8e7f7c
commit f3c5e1924b
6 changed files with 1256 additions and 64 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="content">
<div class="content" >
<div class="leftTree fleft">
<div class="head">
<div class="title">设备分组</div>
@ -95,7 +95,7 @@
</div>
</div>
<el-table ref="grid" height="calc(100vh - 320px)" :v-loading="Status.loading" border :data="deviceList"
<el-table ref="grid" height="calc(100vh - 320px)" v-loading="Status.loading" border :data="deviceList"
@selection-change="RowSelectionChange">
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
@ -144,7 +144,7 @@
<!-- 提示框 -->
<el-dialog :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500" center>
<el-dialog :width="300" :draggable="true" v-model="Status.confirm.Visible" :title="Status.confirm.title" width="500" center>
<span>
{{ Status.confirm.text }}
</span>
@ -200,11 +200,9 @@
</template>
<script setup lang="ts">
import { status } from 'nprogress';
import api from '@/api/equipmentManagement/devicegroup/index';
import { stat } from 'fs';
import { func } from 'vue-types';
import { deviceTypeAll } from '@/api/equipmentManagement/device';
import common from '@/utils/common'
interface Device {
deviceName: string;
@ -318,14 +316,18 @@ var hideConfirm = function () {
}
var showloading = function () {
window.loadingIndex = ElLoading.service({ fullscreen: true })
// window.loadingIndex = ElLoading.service({ fullscreen: true })
Status.loading=true;
}
var closeLoading = function () {
if (window.loadingIndex) {
window.loadingIndex.close();
}
// if (window.loadingIndex) {
// window.loadingIndex.close();
// }
Status.loading=false;
}
var hideloading = closeLoading;
@ -363,7 +365,7 @@ var getDeviceList = () => {
}
//树控件节点点击事件
var handleNodeClick = (node) => {
debugger;
if (checkNode.val == node.id) {
return;
}
@ -408,7 +410,7 @@ var editNode = (node) => {
var completeEdit = (node) => {
let now = DateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
let now =common.DateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
let newNode =
{
@ -453,13 +455,13 @@ var cancelEdit = (node) => {
//删除节点
var delNode = (node) => {
debugger;
if (node.data.children && node.data.children.length > 0) {
alert("节点包含子节点,不允许删除");
return;
}
confirm("您确认删除’" + node.data.groupName + "’节点吗", () => {
debugger;
hideConfirm();
api.delTreeNode(treeDataOrin.value, node.data.id).then((res) => {
@ -478,48 +480,6 @@ var delNode = (node) => {
}
var DateFormat = function (date, format) {
if (!date) {
date = new Date();
}
if (!format) {
format = 'yyyy-MM-dd HH:mm:ss';
}
// 处理参数默认值
if (typeof date === 'string' || typeof date === 'number') {
date = new Date(date);
}
date = date instanceof Date ? date : new Date();
format = format || 'yyyy-MM-dd';
// 检查日期是否有效
if (isNaN(date.getTime())) {
return 'Invalid Date';
}
// 定义格式化映射
const formatMap = {
'yyyy': date.getFullYear(),
'MM': String(date.getMonth() + 1).padStart(2, '0'),
'dd': String(date.getDate()).padStart(2, '0'),
'HH': String(date.getHours()).padStart(2, '0'),
'mm': String(date.getMinutes()).padStart(2, '0'),
'ss': String(date.getSeconds()).padStart(2, '0'),
'SSS': String(date.getMilliseconds()).padStart(3, '0'),
'M': date.getMonth() + 1,
'd': date.getDate(),
'H': date.getHours(),
'm': date.getMinutes(),
's': date.getSeconds(),
'S': date.getMilliseconds()
};
// 替换格式字符串中的占位符
return format.replace(/(yyyy|MM|dd|HH|mm|ss|SSS|M|d|H|m|s|S)/g, (match) => {
return formatMap[match];
});
}
//增加节点
var addNode = (node) => {
let title = '';
@ -533,7 +493,7 @@ var addNode = (node) => {
}
let val = new Date().getTime();
// let newNode = { value: val, txt: '' };
let now = DateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
let now =common.DateFormat(new Date(), "yyyy-MM-dd HH:mm:ss");
@ -543,7 +503,7 @@ var addNode = (node) => {
})
.then(({ value }) => {
debugger;
if (!value) {
alert("请输入分组名称");
return;
@ -596,7 +556,7 @@ var defaultProps = {
}
var RowSelectionChange = (tr) => {
debugger;
console.log("行选中变化", tr);
getSelectionRows();
};
@ -692,7 +652,7 @@ var showDevice = () => {
if (res[1].status == 'fulfilled') {
let res2 = res[1].value;
if (res2.code == 200) {
debugger;
let vals = res2.rows.map(item => item.deviceId);
transfer.value = vals;
@ -710,7 +670,7 @@ var showDevice = () => {
//确认选择这些设备
var OKCheckDevice = () => {
debugger;
let arr = transfer.value.map(item => ({
deviceId: item