Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
DC-TOM
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘照晖
DC-TOM
Commits
c682bc98
Commit
c682bc98
authored
May 26, 2025
by
liuzhaoh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备管理
parent
8fa2603f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
270 additions
and
55 deletions
+270
-55
index.js
src/request/index.js
+17
-0
method.js
src/request/method.js
+12
-0
index.vue
src/views/equipmentManagement/index.vue
+241
-55
No files found.
src/request/index.js
View file @
c682bc98
...
...
@@ -107,6 +107,11 @@ service.interceptors.response.use(
)
{
// 数据下沉的状态码不做报错提示
}
else
{
const
whiteList
=
[
'exportDeviceAndSignal'
]
// 判断是否是下载接口,如果是下载接口,则不进行错误提示
if
(
isExportUrl
(
whiteList
,
response
.
config
.
url
))
{
return
res
}
requestExceptCap
(
response
.
config
,
response
.
status
);
const
msg
=
res
.
message
||
res
.
msg
||
"Error"
;
// msg 是否包含英文字符
...
...
@@ -196,6 +201,7 @@ service.interceptors.response.use(
* @date 2024/3/11
*/
function
requestExceptCap
(
capData
=
{},
code
=
"Network Error"
)
{
return
const
date
=
new
Date
();
const
time
=
format
(
date
);
const
url
=
""
;
...
...
@@ -261,4 +267,15 @@ function format(dataString) {
);
}
// 判断接口链接是否是导出接口
function
isExportUrl
(
whiteList
,
targetUrl
)
{
let
result
=
false
;
for
(
let
i
=
0
;
i
<
whiteList
.
length
;
i
++
)
{
if
(
targetUrl
.
indexOf
(
whiteList
[
i
])
>
-
1
)
{
result
=
true
;
break
;
}
}
return
result
;
}
export
default
service
;
src/request/method.js
View file @
c682bc98
...
...
@@ -125,6 +125,18 @@ export function postDataScreen(url, data) {
});
}
export
function
exportFile
(
method
,
url
,
data
)
{
return
request
({
url
:
url
,
method
,
data
,
headers
:
{
"Content-Type"
:
"multipart/form-data"
},
responseType
:
'blob'
});
}
// 百度坐标转高德(传入经度、纬度)
export
function
bd_decrypt
(
bd_lng
,
bd_lat
)
{
var
X_PI
=
(
Math
.
PI
*
3000.0
)
/
180.0
;
...
...
src/views/equipmentManagement/index.vue
View file @
c682bc98
...
...
@@ -5,22 +5,22 @@
<el-form
:inline=
"true"
:model=
"formInline"
class=
"demo-form-inline"
>
<el-form-item
label=
"工序"
>
<el-select
v-model=
"formInline.
region
"
v-model=
"formInline.
productionLineId
"
placeholder=
"请选择工序"
style=
"width: 120px"
clearable
>
<el-option
v-for=
"item in
o
ptions"
:key=
"item.
value
"
:label=
"item.
label
"
:value=
"item.
value
"
v-for=
"item in
processO
ptions"
:key=
"item.
productionLineId
"
:label=
"item.
productionLineName
"
:value=
"item.
productionLineId
"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"除尘器名称"
>
<el-input
v-model=
"formInline.d
evice
Name"
v-model=
"formInline.d
uster
Name"
placeholder=
"请输入除尘器名称"
style=
"width: 240px"
clearable
...
...
@@ -36,34 +36,54 @@
</el-form-item>
<el-form-item
label=
"设备类型"
>
<el-select
v-model=
"formInline.
region
"
v-model=
"formInline.
deviceTypeId
"
placeholder=
"请选择工序"
style=
"width: 120px"
clearable
>
<el-option
v-for=
"item in
options
"
:key=
"item.
value
"
:label=
"item.
label
"
:value=
"item.
value
"
v-for=
"item in
deviceTypeEnum
"
:key=
"item.
deviceTypeId
"
:label=
"item.
deviceType
"
:value=
"item.
deviceTypeId
"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"default"
class=
"default-btn"
@
click=
"on
Submi
t"
<el-button
type=
"default"
class=
"default-btn"
@
click=
"on
Rese
t"
>
重置
</el-button
>
<el-button
type=
"primary"
class=
"search-btn"
@
click=
"onSubmit"
<el-button
type=
"primary"
class=
"search-btn margin-right-10"
@
click=
"onQuery"
>
查询
</el-button
>
<el-button
type=
"success"
class=
"add-btn"
@
click=
"onSubmit"
>
导入
</el-button
<el-upload
ref=
"upload"
class=
"upload-demo"
:action=
"uploadUrl"
:on-exceed=
"handleExceed"
:on-error=
"handleError"
:on-success=
"handleSuccess"
:on-progress=
"handleProgress"
:before-upload=
"beforeUpload"
:headers=
"
{
token: getToken('TOKEN'),
}"
>
<el-button
type=
"success"
class=
"add-btn"
@
click=
"onSubmit"
<el-button
type=
"success"
class=
"add-btn margin-right-10"
>
导入
</el-button
>
</el-upload>
<el-button
type=
"success"
class=
"add-btn"
@
click=
"onExportFile"
>
导出
</el-button
>
<el-button
type=
"success"
class=
"add-btn"
@
click=
"onSubmit"
<el-button
type=
"success"
class=
"add-btn"
@
click=
"onDownloadTemplate"
>
模板下载
</el-button
>
</el-form-item>
...
...
@@ -75,6 +95,7 @@
:columns=
"tableColumns"
:default-page-size=
"10"
@
pagination-change=
"handlePaginationChange"
:total=
"total"
:pagination-texts=
"
{
total: '共',
sizeChange: '条/页',
...
...
@@ -102,48 +123,33 @@
</div>
</template>
<
script
setup
>
import
{
ref
,
reactive
}
from
"vue"
;
import
{
ref
,
reactive
,
onMounted
}
from
"vue"
;
import
{
ElMessage
}
from
"element-plus"
;
import
setParamsDialog
from
"./components/paramsSetings.vue"
;
import
CommonTable
from
"@/components/commonTable/index.vue"
;
import
"@/css/elementUiSelf.css"
;
import
{
getDataFun
,
exportFile
}
from
"@/request/method.js"
;
import
{
getToken
}
from
"@/utils/auth"
;
const
ENV
=
import
.
meta
.
env
;
const
uploadUrl
=
ENV
.
VITE_APP_BASE_API5
+
"/importDeviceAndSignal"
;
const
currentPage
=
ref
(
1
);
const
pageSize
=
ref
(
10
);
const
total
=
ref
(
0
);
const
getIndex
=
(
index
)
=>
{
return
(
currentPage
.
value
-
1
)
*
pageSize
.
value
+
index
+
1
;
};
const
formInline
=
reactive
({
user
:
""
,
region
:
""
,
date
:
""
,
let
formInline
=
reactive
({
deviceName
:
""
,
dusterName
:
""
,
deviceTypeId
:
" "
,
productionLineId
:
" "
,
});
const
onSubmit
=
()
=>
{
console
.
log
(
"submit!"
);
};
const
tableData
=
[
{
date
:
"2016-05-03"
,
name
:
"Tom"
,
address
:
"No. 189, Grove St, Los Angeles"
,
},
{
date
:
"2016-05-02"
,
name
:
"Tom"
,
address
:
"No. 189, Grove St, Los Angeles"
,
},
{
date
:
"2016-05-04"
,
name
:
"Tom"
,
address
:
"No. 189, Grove St, Los Angeles"
,
},
{
date
:
"2016-05-01"
,
name
:
"Tom"
,
address
:
"No. 189, Grove St, Los Angeles"
,
},
];
const
tableData
=
ref
([]);
const
tableColumns
=
ref
([
{
prop
:
"index"
,
...
...
@@ -151,42 +157,42 @@ const tableColumns = ref([
width
:
"5%"
,
},
{
prop
:
"d
evice
Name"
,
prop
:
"d
uster
Name"
,
label
:
"除尘器名称"
,
width
:
"15%"
,
},
{
prop
:
"d
eviceName
"
,
prop
:
"d
usterNo
"
,
label
:
"除尘器编号"
,
width
:
"15%"
,
},
{
prop
:
"pro
cess
"
,
prop
:
"pro
ductionLine
"
,
label
:
"所属工序"
,
width
:
"5%"
,
},
{
prop
:
"
healthScor
e"
,
prop
:
"
deviceNam
e"
,
label
:
"设备名称"
,
width
:
"5%"
,
},
{
prop
:
"
health2Score
"
,
prop
:
"
deviceTypeDesc
"
,
label
:
"设备类型"
,
width
:
"5%"
,
},
{
prop
:
"s
tatus
"
,
prop
:
"s
ignalName
"
,
label
:
"信号名称"
,
width
:
"25%"
,
},
{
prop
:
"
alarmCount
"
,
prop
:
"
signalNo
"
,
label
:
"信号编码"
,
width
:
"5%"
,
},
{
prop
:
"
lastAlarmTime
"
,
prop
:
"
position
"
,
label
:
"安装位置"
,
width
:
"10%"
,
},
...
...
@@ -203,6 +209,170 @@ const setParams = () => {
const
closeDialog
=
(
val
)
=>
{
dialogVisible
.
value
=
val
;
};
// 工序
const
processOptions
=
ref
([
{
productionLineId
:
" "
,
productionLineName
:
"全部"
},
]);
// 获取工序
const
getProcessOptions
=
()
=>
{
const
url
=
"/transaction/getProductionLine"
;
const
params
=
{
branchFactoryId
:
getToken
(
"dataBranchFactoryId"
),
};
getDataFun
(
url
,
params
)
.
then
((
res
)
=>
{
res
.
data
.
forEach
((
item
)
=>
{
processOptions
.
value
.
push
(
item
);
});
})
.
catch
((
err
)
=>
{
processOptions
.
value
=
[
{
productionLineId
:
""
,
productionLineName
:
"全部"
},
];
});
};
// 设备类型枚举值
const
deviceTypeEnum
=
ref
([{
deviceType
:
"全部"
,
deviceTypeId
:
" "
}]);
// 获取设备类型
const
getDeviceType
=
()
=>
{
const
url
=
"/getDcTomDeviceType"
;
const
params
=
{};
getDataFun
(
url
,
params
)
.
then
((
res
)
=>
{
res
.
data
.
forEach
((
element
)
=>
{
deviceTypeEnum
.
value
.
push
(
element
);
});
})
.
catch
((
err
)
=>
{
deviceTypeEnum
.
value
=
[{
deviceType
:
"全部"
,
deviceTypeId
:
""
}];
});
};
// 获取设备列表
const
getDeviceContent
=
()
=>
{
const
url
=
"/getPageDcTomDeviceResp"
;
const
params
=
{
pageSize
:
pageSize
.
value
,
// 当前页数据条数
pageNo
:
currentPage
.
value
,
// 当前页页码
customerId
:
getToken
(
"customerId"
),
// 客户ID
deviceName
:
formInline
.
deviceName
,
// 设备名称
dusterName
:
formInline
.
dusterName
,
// 除尘器名称
deviceTypeId
:
formInline
.
deviceTypeId
,
// 设备类型
productionLineId
:
formInline
.
productionLineId
,
// 工艺
};
getDataFun
(
url
,
params
)
.
then
((
res
)
=>
{
tableData
.
value
=
(
res
&&
res
.
data
&&
res
.
data
.
records
)
||
[];
total
.
value
=
res
.
data
.
total
||
0
;
})
.
catch
((
err
)
=>
{
tableData
.
value
=
[];
total
.
value
=
0
;
});
};
// 重置
const
onReset
=
()
=>
{
formInline
=
{
deviceName
:
""
,
dusterName
:
""
,
deviceTypeId
:
" "
,
productionLineId
:
" "
,
};
pageSize
.
value
=
10
;
currentPage
.
value
=
1
;
getDeviceContent
();
};
// 查询
const
onQuery
=
()
=>
{
getDeviceContent
();
};
// 导入
const
onImportFile
=
()
=>
{
const
url
=
"/importDeviceAndSignal"
;
const
params
=
{
customerId
:
getToken
(
"customerId"
),
// 客户ID
deviceName
:
formInline
.
deviceName
,
// 设备名称
dusterName
:
formInline
.
dusterName
,
// 除尘器名称
deviceTypeId
:
formInline
.
deviceTypeId
,
// 设备类型
productionLineId
:
formInline
.
productionLineId
,
// 工艺
};
};
// 导出
const
onExportFile
=
()
=>
{
const
url
=
"/exportDeviceAndSignal"
;
const
params
=
{};
exportFile
(
"get"
,
url
,
params
).
then
((
res
)
=>
{
const
blob
=
res
;
// 创建 URL 对象
const
url
=
URL
.
createObjectURL
(
blob
);
// 创建临时
<
a
>
元素
const
a
=
document
.
createElement
(
"a"
);
a
.
href
=
url
;
a
.
download
=
`设备数据.xls`
;
// 设置下载的文件名
// 模拟点击下载
document
.
body
.
appendChild
(
a
);
a
.
click
();
// 清理资源
document
.
body
.
removeChild
(
a
);
URL
.
revokeObjectURL
(
url
);
});
};
// 模板下载
const
onDownloadTemplate
=
()
=>
{};
// 页面参数改变
const
handlePaginationChange
=
(
pagination
)
=>
{
currentPage
.
value
=
pagination
.
currentPage
;
pageSize
.
value
=
pagination
.
pageSize
;
getDeviceContent
();
};
// 当超出限制时,执行的钩子函数
const
handleExceed
=
(
files
)
=>
{
console
.
log
(
"上传超出限制"
);
// upload.value!.clearFiles()
// const file = files[0] as UploadRawFile
// file.uid = genFileId()
// upload.value!.handleStart(file)
};
// 上传失败
const
handleError
=
()
=>
{
ElMessage
({
message
:
"文件上传失败"
,
type
:
"error"
,
duration
:
5
*
1000
,
});
};
const
handleSuccess
=
()
=>
{
ElMessage
({
message
:
"文件上传成功"
,
type
:
"success"
,
duration
:
5
*
1000
,
});
};
const
handleProgress
=
(
evt
,
uploadFile
)
=>
{};
const
beforeUpload
=
(
file
)
=>
{
console
.
log
(
file
);
if
(
file
.
type
!==
"application/vnd.ms-excel"
&&
file
.
type
!==
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)
{
ElMessage
({
message
:
"请上传excel文件"
,
type
:
"primary"
,
duration
:
5
*
1000
,
});
return
false
;
}
else
{
return
true
;
}
};
onMounted
(()
=>
{
getDeviceType
();
getProcessOptions
();
getDeviceContent
();
});
</
script
>
<
style
lang=
"scss"
scoped
>
...
...
@@ -225,7 +395,23 @@ const closeDialog = (val) => {
}
}
}
.default-btn
{
width
:
85px
;
}
.search-btn
{
width
:
85px
;
background
:
#2182a0
;
border
:
1px
solid
#2182a0
;
}
.add-btn
{
width
:
85px
;
}
.margin-right-10
{
margin-right
:
10px
;
}
</
style
>
<
style
scoped
>
/* @import "./elementUiSelf.css"; */
<
style
>
.equipment-management
.el-upload-list
{
display
:
none
;
}
</
style
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment