修复设备分组bug,设备维修bug
This commit is contained in:
@ -6,8 +6,8 @@ VITE_APP_ENV = 'development'
|
|||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
# VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
# VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
||||||
# VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
|
VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
|
||||||
VITE_APP_BASE_API = 'http://192.168.110.56:8000'
|
#VITE_APP_BASE_API = 'http://192.168.110.56:8000'
|
||||||
#代永飞接口
|
#代永飞接口
|
||||||
# VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689'
|
# VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689'
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
VITE_APP_TITLE = 云平台管理系统
|
VITE_APP_TITLE = 云平台管理系统
|
||||||
|
|
||||||
# 生产环境配置 晶全1
|
# 生产环境配置 晶全1
|
||||||
VITE_APP_ENV = 'production'
|
VITE_APP_ENV = 'https://www.cnxhyc.com'
|
||||||
|
|
||||||
# 生产环境配置 富源晟2
|
# 生产环境配置 富源晟2
|
||||||
# VITE_APP_ENV = 'https://fuyuanshen.com/backend-fys'
|
# VITE_APP_ENV = 'https://fuyuanshen.com/backend-fys'
|
||||||
|
|
||||||
# 应用访问路径 晶全1
|
# 应用访问路径 晶全1
|
||||||
VITE_APP_CONTEXT_PATH = '/'
|
VITE_APP_CONTEXT_PATH = '/jingquan/'
|
||||||
|
|
||||||
# 应用访问路径 富源晟2
|
# 应用访问路径 富源晟2
|
||||||
#VITE_APP_CONTEXT_PATH = '/sys/'
|
#VITE_APP_CONTEXT_PATH = '/sys/'
|
||||||
@ -19,9 +19,8 @@ VITE_APP_MONITOR_ADMIN = '/admin/applications'
|
|||||||
# SnailJob 控制台地址
|
# SnailJob 控制台地址
|
||||||
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
|
VITE_APP_SNAILJOB_ADMIN = '/snail-job'
|
||||||
|
|
||||||
# 生产环境 晶全3
|
# 生产环境 晶全3 代理访问
|
||||||
VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
VITE_APP_BASE_API = '/jq'
|
||||||
VITE_AMAP_KEY='84a12a692ae378effdf741e16d584cd3'
|
|
||||||
|
|
||||||
# 生产环境 富源晟3
|
# 生产环境 富源晟3
|
||||||
#VITE_APP_BASE_API = '/backend-fys'
|
#VITE_APP_BASE_API = '/backend-fys'
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="content" v-loading="Status.fullLoading">
|
<div class="content" v-loading="Status.fullLoading">
|
||||||
<div class="main">
|
<div class="main">
|
||||||
<div class="TopTool">
|
<div class ="TopTool">
|
||||||
<div class="button-row">
|
<div class="button-row">
|
||||||
<el-button type="primary" icon="Plus" @click.stop="ShowEdit(null, true, formRef)">新增维修</el-button>
|
<el-button type="primary" icon="Plus" @click.stop="ShowEdit(null, true, formRef)">新增维修</el-button>
|
||||||
<el-button type="primary" plain icon="Download" @click.stop="ExportRecord()">导出</el-button>
|
<el-button type="primary" plain icon="Download" @click.stop="ExportRecord()">导出</el-button>
|
||||||
@ -9,14 +9,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="rightSearch">
|
<div class="rightSearch">
|
||||||
<el-input
|
<el-input :suffix-icon="'Search'" clearable v-model="advanceSearch.searchValue" class="responsive-input"
|
||||||
:suffix-icon="'Search'"
|
placeholder="名称" @input="txtSearch">
|
||||||
clearable
|
|
||||||
v-model="advanceSearch.searchValue"
|
|
||||||
class="responsive-input"
|
|
||||||
placeholder="名称"
|
|
||||||
@input="txtSearch"
|
|
||||||
>
|
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
<el-button style="margin-left: 10px" type="primary" @click.stop="ToggleAdvance()">高级筛选</el-button>
|
<el-button style="margin-left: 10px" type="primary" @click.stop="ToggleAdvance()">高级筛选</el-button>
|
||||||
@ -43,17 +37,9 @@
|
|||||||
<el-input v-model="advanceSearch.repairReason" placeholder="请输入" clearable />
|
<el-input v-model="advanceSearch.repairReason" placeholder="请输入" clearable />
|
||||||
</el-form-item> -->
|
</el-form-item> -->
|
||||||
<el-form-item label="维修时间">
|
<el-form-item label="维修时间">
|
||||||
<el-date-picker
|
<el-date-picker v-model="advanceSearch.Date" type="daterange" format="YYYY-MM-DD" style="width: 240px"
|
||||||
v-model="advanceSearch.Date"
|
value-format="YYYY-MM-DD" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
|
||||||
type="daterange"
|
:size="'default'" />
|
||||||
format="YYYY-MM-DD"
|
|
||||||
style="width: 240px"
|
|
||||||
value-format="YYYY-MM-DD"
|
|
||||||
range-separator="-"
|
|
||||||
start-placeholder="开始日期"
|
|
||||||
end-placeholder="结束日期"
|
|
||||||
:size="'default'"
|
|
||||||
/>
|
|
||||||
<div>
|
<div>
|
||||||
<el-button style="margin-left: 5px" type="primary" @click.stop="Search()">查询</el-button>
|
<el-button style="margin-left: 5px" type="primary" @click.stop="Search()">查询</el-button>
|
||||||
<el-button type="primary" @click.stop="Reset()">重置</el-button>
|
<el-button type="primary" @click.stop="Reset()">重置</el-button>
|
||||||
@ -71,7 +57,8 @@
|
|||||||
<el-table-column label="损坏原因" align="center" prop="repairReason" />
|
<el-table-column label="损坏原因" align="center" prop="repairReason" />
|
||||||
<el-table-column label="维修人员" align="center" prop="repairPerson" />
|
<el-table-column label="维修人员" align="center" prop="repairPerson" />
|
||||||
|
|
||||||
<el-table-column label="操作" align="center" fixed="right" width="280" class-name="small-padding fixed-width opt">
|
<el-table-column label="操作" align="center" fixed="right" width="280"
|
||||||
|
class-name="small-padding fixed-width opt">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, true, formRef)">编辑</el-text>
|
<el-text class="mx-1" type="primary" @click.stop="ShowEdit(scope.row, true, formRef)">编辑</el-text>
|
||||||
@ -81,47 +68,29 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination v-show="pagin.total > 0" v-model:page="advanceSearch.pageNum" v-model:limit="advanceSearch.pageSize"
|
||||||
v-show="pagin.total > 0"
|
:total="pagin.total" @pagination="getRecordList" />
|
||||||
v-model:page="advanceSearch.pageNum"
|
|
||||||
v-model:limit="advanceSearch.pageSize"
|
|
||||||
:total="pagin.total"
|
|
||||||
@pagination="getRecordList"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 新增、编辑弹出层 -->
|
<!-- 新增、编辑弹出层 -->
|
||||||
<el-dialog
|
<el-dialog class="editPop" v-model="Status.ShowEditPop" :data-val="Status.ShowEditPop"
|
||||||
class="editPop"
|
:title="!cEdit.isEdit ? '维修详情' : cEdit.recordId ? '编辑维修' : '新增维修'" width="800" :draggable="true">
|
||||||
v-model="Status.ShowEditPop"
|
|
||||||
:data-val="Status.ShowEditPop"
|
|
||||||
:title="!cEdit.isEdit ? '维修详情' : cEdit.recordId ? '编辑维修' : '新增维修'"
|
|
||||||
width="800"
|
|
||||||
:draggable="true"
|
|
||||||
>
|
|
||||||
<div class="form">
|
<div class="form">
|
||||||
<el-form :model="cEdit" ref="formRef" style="max-width: 750px" :rules="rules">
|
<el-form :model="cEdit" ref="formRef" style="max-width: 750px" :rules="rules">
|
||||||
<el-form-item label="设备名称" label-position="right" prop="deviceId">
|
<el-form-item label="设备名称" label-position="right" prop="deviceId">
|
||||||
<!-- <el-input v-model="selectedRow['deviceName']" :readonly="true" @click.stop="ShowDevice('Edit', true)" placeholder="请选择设备" /> -->
|
<!-- <el-input v-model="selectedRow['deviceName']" :readonly="true" @click.stop="ShowDevice('Edit', true)" placeholder="请选择设备" /> -->
|
||||||
<el-select v-model="cEdit.deviceId" placeholder="选择设备" clearable :disabled="!cEdit.isEdit" filterable>
|
<el-select v-model="cEdit.deviceId" placeholder="选择设备" clearable :disabled="!cEdit.isEdit" filterable>
|
||||||
<el-option v-for="item in deviceDist" :key="item.deviceId" :label="item.deviceName" :value="item.deviceId"
|
<el-option v-for="item in deviceDist" :key="item.deviceId" :label="item.deviceName"
|
||||||
/></el-select>
|
:value="item.deviceId" /></el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="维修人员" label-position="right" prop="repairPerson">
|
<el-form-item label="维修人员" label-position="right" prop="repairPerson">
|
||||||
<el-input v-model="cEdit.repairPerson" :readonly="!cEdit.isEdit" placeholder="请输入姓名" />
|
<el-input v-model="cEdit.repairPerson" :readonly="!cEdit.isEdit" placeholder="请输入姓名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="维修时间" label-position="right" prop="repairTime">
|
<el-form-item label="维修时间" label-position="right" prop="repairTime">
|
||||||
<el-date-picker
|
<el-date-picker v-model="cEdit.repairTime" :readonly="!cEdit.isEdit" type="datetime" placeholder="请选择时间"
|
||||||
v-model="cEdit.repairTime"
|
format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" />
|
||||||
:readonly="!cEdit.isEdit"
|
|
||||||
type="datetime"
|
|
||||||
placeholder="请选择时间"
|
|
||||||
format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
value-format="YYYY-MM-DD HH:mm:ss"
|
|
||||||
style="width: 100%"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="维修部位" label-position="right" prop="repairPart">
|
<el-form-item label="维修部位" label-position="right" prop="repairPart">
|
||||||
<el-input v-model="cEdit.repairPart" :readonly="!cEdit.isEdit" placeholder="请输入维修部位" />
|
<el-input v-model="cEdit.repairPart" :readonly="!cEdit.isEdit" placeholder="请输入维修部位" />
|
||||||
@ -131,19 +100,10 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="损坏照片" label-position="right">
|
<el-form-item label="损坏照片" label-position="right">
|
||||||
<el-upload
|
<el-upload :disabled="!cEdit.isEdit" ref="beforeUploadRef" class="upload-demo" action=""
|
||||||
:disabled="!cEdit.isEdit"
|
:auto-upload="false" :on-change="handleFileChange1" :file-list="beforeFiles"
|
||||||
ref="beforeUploadRef"
|
accept=".jpg,.jpeg,.png,.gif.webp" :limit="9" list-type="picture-card"
|
||||||
class="upload-demo"
|
:class="{ 'hide-add-btn': !cEdit.isEdit }">
|
||||||
action=""
|
|
||||||
:auto-upload="false"
|
|
||||||
:on-change="handleFileChange1"
|
|
||||||
:file-list="beforeFiles"
|
|
||||||
accept=".jpg,.jpeg,.png,.gif.webp"
|
|
||||||
:limit="9"
|
|
||||||
list-type="picture-card"
|
|
||||||
:class="{ 'hide-add-btn': !cEdit.isEdit }"
|
|
||||||
>
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -168,19 +128,9 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="修复照片" label-position="right">
|
<el-form-item label="修复照片" label-position="right">
|
||||||
<el-upload
|
<el-upload :disabled="!cEdit.isEdit" ref="afterUploadRef" class="upload-demo" action="" :auto-upload="false"
|
||||||
:disabled="!cEdit.isEdit"
|
:on-change="handleFileChange2" :file-list="afterFiles" accept=".jpg,.jpeg,.png,.gif.webp" :limit="9"
|
||||||
ref="afterUploadRef"
|
list-type="picture-card" :class="{ 'hide-add-btn': !cEdit.isEdit }">
|
||||||
class="upload-demo"
|
|
||||||
action=""
|
|
||||||
:auto-upload="false"
|
|
||||||
:on-change="handleFileChange2"
|
|
||||||
:file-list="afterFiles"
|
|
||||||
accept=".jpg,.jpeg,.png,.gif.webp"
|
|
||||||
:limit="9"
|
|
||||||
list-type="picture-card"
|
|
||||||
:class="{ 'hide-add-btn': !cEdit.isEdit }"
|
|
||||||
>
|
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Plus />
|
<Plus />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -321,7 +271,8 @@
|
|||||||
</el-dialog> -->
|
</el-dialog> -->
|
||||||
|
|
||||||
<!-- 提示框 -->
|
<!-- 提示框 -->
|
||||||
<el-dialog :width="300" :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>
|
<span>
|
||||||
{{ Status.confirm.text }}
|
{{ Status.confirm.text }}
|
||||||
</span>
|
</span>
|
||||||
@ -509,18 +460,21 @@ function ToggleAdvance() {
|
|||||||
|
|
||||||
//显示编辑
|
//显示编辑
|
||||||
function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
||||||
|
// 先隐藏弹窗,避免提前渲染错误状态
|
||||||
Status.ShowEditPop = true;
|
Status.ShowEditPop = true;
|
||||||
let def = {
|
let def = {
|
||||||
recordId: null, //维修记录id
|
recordId: null,
|
||||||
|
deviceId: '',
|
||||||
deviceId: '', //设备id
|
repairTime: '',
|
||||||
repairTime: '', //维修时间
|
repairPart: '',
|
||||||
repairPart: '', //维修部位
|
repairReason: '',
|
||||||
repairReason: '', //维修原因
|
repairPerson: '',
|
||||||
repairPerson: '', //维修人员,
|
|
||||||
imageIds: []
|
imageIds: []
|
||||||
};
|
};
|
||||||
|
// 先重置表单和状态,避免残留
|
||||||
|
ResetFormData();
|
||||||
|
// 先赋值 isEdit 基础状态
|
||||||
|
cEdit.isEdit = isEdit;
|
||||||
let promise1 = new Promise((resolve, reject) => {
|
let promise1 = new Promise((resolve, reject) => {
|
||||||
if (item) {
|
if (item) {
|
||||||
api
|
api
|
||||||
@ -542,60 +496,43 @@ function ShowEdit(item = undefined, isEdit = true, formEl = undefined) {
|
|||||||
|
|
||||||
promise1
|
promise1
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
debugger;
|
|
||||||
item = res;
|
item = res;
|
||||||
if (!item) {
|
if (!item) {
|
||||||
|
// 新增场景,isEdit 保持 true
|
||||||
cEdit.isEdit = isEdit;
|
cEdit.isEdit = isEdit;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let keys = Object.keys(cEdit);
|
let keys = Object.keys(cEdit);
|
||||||
keys.forEach((key, i) => {
|
keys.forEach((key, i) => {
|
||||||
if (item) {
|
if (item) {
|
||||||
//编辑
|
// 编辑/详情场景,赋值数据
|
||||||
if (item[key] !== undefined) {
|
if (item[key] !== undefined) {
|
||||||
cEdit[key] = item[key];
|
cEdit[key] = item[key];
|
||||||
} else {
|
} else {
|
||||||
cEdit[key] = def[key];
|
cEdit[key] = def[key];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//新增
|
// 新增场景
|
||||||
cEdit[key] = def[key];
|
cEdit[key] = def[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
debugger;
|
|
||||||
if (item.images && item.images.length) {
|
if (item.images && item.images.length) {
|
||||||
|
// 处理图片逻辑(保持原有代码)
|
||||||
beforeFiles.value = item.images
|
beforeFiles.value = item.images
|
||||||
.filter((v) => {
|
.filter((v) => v.imageType == 'BEFORE')
|
||||||
if (v.imageType == 'BEFORE') {
|
.map((v) => ({ name: v.imageId, url: v.imageUrl, id: v.imageId }));
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.map((v) => {
|
|
||||||
return { name: v.imageId, url: v.imageUrl, id: v.imageId };
|
|
||||||
});
|
|
||||||
|
|
||||||
afterFiles.value = item.images
|
afterFiles.value = item.images
|
||||||
.filter((v) => {
|
.filter((v) => v.imageType == 'AFTER')
|
||||||
if (v.imageType == 'AFTER') {
|
.map((v) => ({ name: v.imageId, url: v.imageUrl, id: v.imageId }));
|
||||||
return true;
|
if (formEl) formEl.validate();
|
||||||
}
|
|
||||||
return false;
|
|
||||||
})
|
|
||||||
.map((v) => {
|
|
||||||
return { name: v.imageId, url: v.imageUrl, id: v.imageId };
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!formEl) return;
|
|
||||||
|
|
||||||
formEl.validate();
|
|
||||||
}
|
}
|
||||||
if (item) {
|
if (item) {
|
||||||
selectedRow.value['deviceName'] = item.deviceName;
|
selectedRow.value['deviceName'] = item.deviceName;
|
||||||
}
|
}
|
||||||
|
// 确保 isEdit 最终赋值正确(覆盖异步过程中可能的异常)
|
||||||
cEdit.isEdit = isEdit;
|
cEdit.isEdit = isEdit;
|
||||||
|
// 所有状态赋值完成后,再显示弹窗
|
||||||
|
Status.ShowEditPop = true;
|
||||||
})
|
})
|
||||||
.finally(() => {});
|
.finally(() => {});
|
||||||
}
|
}
|
||||||
@ -611,11 +548,9 @@ function ShowDevice(type, isvalid) {
|
|||||||
if (isvalid && !cEdit.isEdit) {
|
if (isvalid && !cEdit.isEdit) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status.CheckDeviceType = type;
|
Status.CheckDeviceType = type;
|
||||||
Status.ShowCheckDevice = true;
|
Status.ShowCheckDevice = true;
|
||||||
selectedRowId.value = '';
|
selectedRowId.value = '';
|
||||||
|
|
||||||
if (total.value === 0) {
|
if (total.value === 0) {
|
||||||
handleQuery();
|
handleQuery();
|
||||||
}
|
}
|
||||||
@ -643,11 +578,8 @@ function ResetFormData() {
|
|||||||
cEdit.repairPart = ''; //维修部位
|
cEdit.repairPart = ''; //维修部位
|
||||||
cEdit.repairReason = ''; //维修原因
|
cEdit.repairReason = ''; //维修原因
|
||||||
cEdit.repairPerson = ''; //维修人员
|
cEdit.repairPerson = ''; //维修人员
|
||||||
|
|
||||||
cEdit.imageIds = [];
|
cEdit.imageIds = [];
|
||||||
|
|
||||||
selectedRow.value = { deviceName: '', deviceId: '' };
|
selectedRow.value = { deviceName: '', deviceId: '' };
|
||||||
|
|
||||||
clearUploadFiles();
|
clearUploadFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,7 +681,7 @@ function ExportRecord() {
|
|||||||
proxy?.download('/equipment/repairRecords/export', advanceSearch, `维修记录_${new Date().getTime()}.xlsx`, 'post').finally(hideloading);
|
proxy?.download('/equipment/repairRecords/export', advanceSearch, `维修记录_${new Date().getTime()}.xlsx`, 'post').finally(hideloading);
|
||||||
}
|
}
|
||||||
|
|
||||||
function RowSelectionChange(row) {}
|
function RowSelectionChange(row) { }
|
||||||
//获取已选中的行
|
//获取已选中的行
|
||||||
var getSelectionRows = (gridInstance) => {
|
var getSelectionRows = (gridInstance) => {
|
||||||
if (gridInstance.value) {
|
if (gridInstance.value) {
|
||||||
@ -950,8 +882,9 @@ const rules = reactive<FormRules<RuleForm>>({
|
|||||||
:deep .el-form--inline .el-form-item {
|
:deep .el-form--inline .el-form-item {
|
||||||
margin-right: 15px !important;
|
margin-right: 15px !important;
|
||||||
}
|
}
|
||||||
:deep .el-dialog__body .form {
|
|
||||||
}
|
:deep .el-dialog__body .form {}
|
||||||
|
|
||||||
:deep .el-dialog__body,
|
:deep .el-dialog__body,
|
||||||
.dialog__body {
|
.dialog__body {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -1064,6 +997,7 @@ input:focus {
|
|||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep .el-dialog__footer,
|
:deep .el-dialog__footer,
|
||||||
.el-dialog__footer {
|
.el-dialog__footer {
|
||||||
padding-top: 0px !important;
|
padding-top: 0px !important;
|
||||||
|
|||||||
@ -10,7 +10,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="treeContent">
|
<div class="treeContent">
|
||||||
<el-tree :default-expand-all="true" :data="treeData" :props="defaultProps" accordion @node-click="handleNodeClick" :highlight-current="true">
|
<el-tree :default-expand-all="true" :data="treeData" :props="defaultProps" accordion
|
||||||
|
@node-click="handleNodeClick" :highlight-current="true">
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<div class="custom-tree-node">
|
<div class="custom-tree-node">
|
||||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||||
@ -60,7 +61,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<div class="btnSearch" @click="getDeviceList()">查询</div>
|
<div class="btnSearch" @click="getDeviceList">查询</div>
|
||||||
<div class="btnReset" @click="ResetQuery()">重置</div>
|
<div class="btnReset" @click="ResetQuery()">重置</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@ -76,14 +77,8 @@
|
|||||||
<el-button type="danger" plain @click="groupDelDevice()">删除</el-button>
|
<el-button type="danger" plain @click="groupDelDevice()">删除</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-table
|
<el-table ref="grid" height="calc(100vh - 320px)" v-loading="Status.loading" border :data="deviceList"
|
||||||
ref="grid"
|
@selection-change="RowSelectionChange">
|
||||||
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 type="selection" width="50" align="center" />
|
||||||
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
<el-table-column label="设备名称" align="center" prop="deviceName" />
|
||||||
|
|
||||||
@ -91,11 +86,9 @@
|
|||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-popover placement="right" trigger="click">
|
<el-popover placement="right" trigger="click">
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<img
|
<img :src="scope.row.devicePic"
|
||||||
:src="scope.row.devicePic"
|
|
||||||
style="width: 40px; height: 40px; cursor: pointer; object-fit: contain"
|
style="width: 40px; height: 40px; cursor: pointer; object-fit: contain"
|
||||||
class="hover:opacity-80 transition-opacity"
|
class="hover:opacity-80 transition-opacity" />
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
<img :src="scope.row.devicePic" style="max-width: 600px; max-height: 600px; object-fit: contain" />
|
<img :src="scope.row.devicePic" style="max-width: 600px; max-height: 600px; object-fit: contain" />
|
||||||
</el-popover>
|
</el-popover>
|
||||||
@ -120,13 +113,8 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination v-show="pagin.total > 0" v-model:page="GjSearchForm.pageNum" v-model:limit="GjSearchForm.pageSize"
|
||||||
v-show="pagin.total > 0"
|
:total="pagin.total" @pagination="getDeviceList" />
|
||||||
v-model:page="GjSearchForm.pageNum"
|
|
||||||
v-model:limit="GjSearchForm.pageSize"
|
|
||||||
:total="pagin.total"
|
|
||||||
@pagination="getDeviceList"
|
|
||||||
/>
|
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -134,7 +122,8 @@
|
|||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
<!-- 提示框 -->
|
<!-- 提示框 -->
|
||||||
<el-dialog :width="300" :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>
|
<span>
|
||||||
{{ Status.confirm.text }}
|
{{ Status.confirm.text }}
|
||||||
</span>
|
</span>
|
||||||
@ -148,7 +137,7 @@
|
|||||||
|
|
||||||
<!-- 选择分组的弹窗 -->
|
<!-- 选择分组的弹窗 -->
|
||||||
<el-dialog v-model="Status.dialogGroupVisible" title="选择分组" width="500" :draggable="true">
|
<el-dialog v-model="Status.dialogGroupVisible" title="选择分组" width="500" :draggable="true">
|
||||||
<el-tree :data="treeData" :props="defaultProps" accordion>
|
<el-tree :data="treeData" :props="defaultProps" accordion default-expand-all>
|
||||||
<template #default="{ node, data }">
|
<template #default="{ node, data }">
|
||||||
<div class="custom-tree-node" @click.stop="CheckGroup(data)">
|
<div class="custom-tree-node" @click.stop="CheckGroup(data)">
|
||||||
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
<span :class="data.parentId != null ? '' : 'treeBold'">{{ node.label }}</span>
|
||||||
@ -156,8 +145,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-tree>
|
</el-tree>
|
||||||
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
<div style="text-align: right;">
|
||||||
<el-button type="primary" @click="CancelCheckGroup()"> 取消 </el-button>
|
|
||||||
|
<el-button @click="CancelCheckGroup()"> 取消 </el-button>
|
||||||
|
<el-button type="primary" @click="OkCheckGroup()"> 确定 </el-button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 选择设备的穿梭框 -->
|
<!-- 选择设备的穿梭框 -->
|
||||||
@ -171,13 +164,8 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 添加节点的弹出框 -->
|
<!-- 添加节点的弹出框 -->
|
||||||
<el-dialog
|
<el-dialog :width="350" :draggable="true" v-model="Status.dialogEditNode"
|
||||||
:width="350"
|
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'" center>
|
||||||
:draggable="true"
|
|
||||||
v-model="Status.dialogEditNode"
|
|
||||||
:title="cEdit.id ? '修改分组' : cEdit.pNode ? '新增子节点' : '新增根节点'"
|
|
||||||
center
|
|
||||||
>
|
|
||||||
<div>
|
<div>
|
||||||
<el-form class="demo-form-inline" :inline="true" :model="cEdit" label-width="auto" style="width: 100%">
|
<el-form class="demo-form-inline" :inline="true" :model="cEdit" label-width="auto" style="width: 100%">
|
||||||
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item>
|
<el-form-item label="分组名称"> <el-input v-model="cEdit.groupName" placeholder="请输入" /> </el-form-item>
|
||||||
@ -324,38 +312,40 @@ var hideloading = closeLoading;
|
|||||||
function ResetQuery() {
|
function ResetQuery() {
|
||||||
GjSearchForm.deviceType = '';
|
GjSearchForm.deviceType = '';
|
||||||
GjSearchForm.netMode = '';
|
GjSearchForm.netMode = '';
|
||||||
|
getDeviceList()
|
||||||
|
|
||||||
}
|
}
|
||||||
//查询某个节点的设备
|
//查询某个节点的设备
|
||||||
var getDeviceList = () => {
|
const getDeviceList = () => {
|
||||||
if (!checkNode.val) {
|
// 无论是否有 checkNode.val,都返回 Promise
|
||||||
pagin.total = 0;
|
|
||||||
deviceList.value = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let para = {
|
|
||||||
nodeCode: checkNode.val,
|
|
||||||
pageIndex: GjSearchForm.pageNum,
|
|
||||||
pageSize: GjSearchForm.pageSize,
|
|
||||||
communicationMode: GjSearchForm.netMode,
|
|
||||||
deviceType: GjSearchForm.deviceType,
|
|
||||||
deviceName: GjSearchForm.deviceName
|
|
||||||
};
|
|
||||||
showloading();
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
api
|
if (!checkNode.val && checkNode.val !== '') { // 排除全部设备的空字符串
|
||||||
.getNodeDevice(para)
|
pagin.total = 0;
|
||||||
.then((res) => {
|
deviceList.value = [];
|
||||||
deviceList.value = res.rows;
|
hideloading(); // 确保 loading 关闭
|
||||||
pagin.total = res.total;
|
resolve();
|
||||||
})
|
return;
|
||||||
.catch((ex) => {
|
}
|
||||||
console.log('出现了异常', ex);
|
showloading();
|
||||||
})
|
let para = {
|
||||||
.finally(() => {
|
nodeCode: checkNode.val || '', // 空ID对应全部设备
|
||||||
hideloading();
|
pageIndex: GjSearchForm.pageNum,
|
||||||
resolve();
|
pageSize: GjSearchForm.pageSize,
|
||||||
});
|
communicationMode: GjSearchForm.netMode,
|
||||||
|
deviceType: GjSearchForm.deviceType,
|
||||||
|
deviceName: GjSearchForm.deviceName
|
||||||
|
};
|
||||||
|
api.getNodeDevice(para).then((res: any) => {
|
||||||
|
console.log(res, 'ressss');
|
||||||
|
deviceList.value = res.rows;
|
||||||
|
pagin.total = res.total;
|
||||||
|
resolve();
|
||||||
|
}).catch((ex) => {
|
||||||
|
console.log('出现了异常', ex);
|
||||||
|
reject(ex); // 抛出错误
|
||||||
|
}).finally(() => {
|
||||||
|
hideloading();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
//树控件节点点击事件
|
//树控件节点点击事件
|
||||||
@ -368,16 +358,26 @@ var handleNodeClick = (node) => {
|
|||||||
getDeviceList();
|
getDeviceList();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ALL_DEVICE_NODE = {
|
||||||
|
id: '',
|
||||||
|
groupName: '全部设备',
|
||||||
|
parentId: null,
|
||||||
|
children: [],
|
||||||
|
isAll: true
|
||||||
|
};
|
||||||
//树控件筛选后显示的数据源
|
//树控件筛选后显示的数据源
|
||||||
var treeData = computed(() => {
|
var treeData = computed(() => {
|
||||||
let arr = api.treeNodeSearch(treeDataOrin.value, searchTxt.value, 'groupName', 'children');
|
let arr = api.treeNodeSearch(treeDataOrin.value, searchTxt.value, 'groupName', 'children');
|
||||||
if (arr.length && !checkNode.val) {
|
let newArr = [JSON.parse(JSON.stringify(ALL_DEVICE_NODE))];
|
||||||
checkNode.val = arr[0].id;
|
if (arr.length) {
|
||||||
getDeviceList().finally(() => {
|
newArr = newArr.concat(arr);
|
||||||
checkNode.val = '';
|
}
|
||||||
|
if (newArr.length && !checkNode.val) {
|
||||||
|
checkNode.val = newArr[0].id; // 空ID
|
||||||
|
Promise.resolve(getDeviceList()).finally(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return arr;
|
return newArr;
|
||||||
});
|
});
|
||||||
|
|
||||||
//显示/隐藏高级筛选
|
//显示/隐藏高级筛选
|
||||||
@ -565,6 +565,7 @@ var getSelectionRows = () => {
|
|||||||
|
|
||||||
var RefreshTree = function () {
|
var RefreshTree = function () {
|
||||||
api.getTreeData(searchTxt.value).then((res) => {
|
api.getTreeData(searchTxt.value).then((res) => {
|
||||||
|
console.log(res, 'reddddd');
|
||||||
treeDataOrin.value = res;
|
treeDataOrin.value = res;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -636,9 +637,8 @@ var showDevice = () => {
|
|||||||
let arr = res1.rows.map((item) => ({
|
let arr = res1.rows.map((item) => ({
|
||||||
key: item.deviceId,
|
key: item.deviceId,
|
||||||
label: item.deviceName //,
|
label: item.deviceName //,
|
||||||
// disabled: item.groupId && item.groupId == checkNode.val ? false : item.groupId ? true : false
|
|
||||||
}));
|
}));
|
||||||
|
;
|
||||||
transfer.data = arr;
|
transfer.data = arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user