设备图纸

This commit is contained in:
xusd 2024-06-12 16:38:02 +08:00
parent 25228c2eed
commit 32bd7bdcc6
6 changed files with 407 additions and 2 deletions

10
api/drawing/drawing.js Normal file
View File

@ -0,0 +1,10 @@
import request from "@/utils/request";
// 查询设备图纸列表
export function listDrawing(query) {
return request({
url: "/equip/drawings/list",
method: "get",
params: query,
});
}

View File

@ -157,6 +157,13 @@
{ {
"navigationBarTitleText" : "巡检详情" "navigationBarTitleText" : "巡检详情"
} }
},
{
"path" : "pages/work/drawing/listDrawing",
"style" :
{
"navigationBarTitleText" : "设备图纸"
}
}], }],
"tabBar": { "tabBar": {
"color": "#000000", "color": "#000000",

View File

@ -0,0 +1,352 @@
<template>
<view class="card-group">
<u-popup :show="showEquip" mode="bottom" :closeable="closeableEquip" @open="openPopupEquip"
@close="closePopupEquip">
<ly-tree :tree-data="treeData" :ready="ready" node-key="id" :props="props"
:expandOnClickNode="expandOnClickNode" @node-click="handleNodeClick"></ly-tree>
</u-popup>
<u-popup :show="showDrawing" mode="bottom" :closeable="closeableDrawing" @open="openPopupDrawing"
@close="closePopupDrawing">
<u-collapse style="margin-top: 40px;">
<u-collapse-item :title="item.fileName" :isLink="isLink" :disabled="disabled"
v-for="(item,index) in itemDrawingList">
<text v-if="!item.localHave" style="color: #1771f7;" slot="value"
class="u-page__item__title__slot-title"
@click="downloadDrawing(item.fileName,item.url,index)">下载</text>
<text v-if="item.localHave" style="color: #1771f7;" slot="value" @click="openDrawing(item.fileName)"
class="u-page__item__title__slot-title">打开</text>
</u-collapse-item>
</u-collapse>
</u-popup>
<u-button :disabled="isJump" @click="showEquip = true">{{equipName}}</u-button>
<view class="card-group" v-if="total === 0">
<leruge-empty text="暂无数据" type="minus"></leruge-empty>
</view>
<view class="cu-card dynamic" v-if="total != 0" v-for="(item,index) in drawingList" :key="index">
<view class="cu-item shadow">
<view class="cu-list menu-avatar">
<view class="cu-item">
<view class="content flex-sub card-title">
<view>{{item.drawingName}}</view>
<button @click="clickDownload(item.equipDrawingPath)" class="label-btn" size="mini"
style="background: #1771f7;color: #FFF;">下载图纸</button>
</view>
</view>
</view>
<view class="content-container">
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">图纸编号: {{item.drawingNum}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">所属设备: {{item.equipName}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">上传时间: {{item.createTime}}</text>
</view>
<view class="text-content">
<text class="iconfont "></text>
<text class="text-description">备注: {{item.remark}}</text>
</view>
</view>
</view>
</view>
<view v-if="finished == true" class="loading-tip">{{ tipText }}</view>
</view>
</template>
<script>
import config from '@/config'
const baseUrl = config.baseUrl
import {
getEquipTree
} from "@/api/equip/equip.js"
import {
listDrawing
} from "@/api/drawing/drawing.js"
export default {
data() {
return {
isJump: false,
disabled: true,
isLink: false,
showDrawing: false,
//
closeableDrawing: true,
expandOnClickNode: false,
//
closeableEquip: true,
//
showEquip: false,
//
treeData: [],
ready: false,
//
finished: false,
tipText: "正在加载...",
total: 0,
drawingList: [],
props: function() {
return {
label: 'equipName',
children: 'childList'
}
},
equipId: null,
equipName: "选择设备",
queryParams: {
pageNum: 1,
pageSize: 10
},
itemDrawingList: [],
}
},
onShow() {
this.drawingList = [];
this.queryParams = {
pageNum: 1,
pageSize: 10
};
this.getDrawingList();
},
onLoad(opts) {
this.equipId = opts.equipId;
this.equipName = opts.equipName;
if (opts.equipId != null && opts.equipId != '') {
this.isJump = true;
}
},
onReachBottom() {
const allTotal = this.queryParams.pageNum * this.queryParams.pageSize;
if (allTotal < this.total) {
this.queryParams.pageNum += 1;
this.getDrawingList();
} else {
this.finished = true;
this.tipText = "已加载完成";
}
},
methods: {
//
openDrawing(fileName) {
// App
if (this.$scope.$mp && this.$scope.$mp.runtime && this.$scope.$mp.runtime === 'app-plus') {
// Appplus.io.getRoot()
plus.io.getRoot((root) => {
console.log('App根目录' + root);
});
} else {
console.log('当前不是App环境无法获取根目录');
}
console.log(fileName)
let fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
console.log(fileType)
uni.openDocument({
showMenu: true,
fileType: fileType,
filePath: 'file://storage/emulated/0/Android/data/com.inspur.ipcApp/apps/__UNI__B298C37/downloads/storage/ipcApp/' +
fileName,
success: function(res) {
console.log(res, "打开文件成功");
},
fail: function(res) {
console.log(res)
uni.showToast({
title: "打开文件失败请重试",
icon: "none",
});
},
});
},
//--
downloadDrawing(name, url, index) {
let progressVal = 0;
let that = this
uni.showLoading({
title: '正在下载……'
});
let dtask = plus.downloader.createDownload(url, {
// filename: 'file://storage/ipcApp/' + name
filename: 'file://storage/ipcApp/' + name
}, function(d, status) {
uni.hideLoading();
if (status == 200) {
uni.$u.toast('下载成功')
let fileSaveUrl = plus.io.convertLocalFileSystemURL(d.filename);
console.log(fileSaveUrl)
that.itemDrawingList[index].localHave = true;
} else {
uni.$u.toast('下载失败')
plus.downloader.clear();
}
});
dtask.start();
},
clickDownload(paths) {
this.itemDrawingList = [];
if (paths != null && paths != '') {
let list = paths.split(",");
list.forEach((item, index) => {
let fileName = item.substring(item.lastIndexOf("/") + 1)
const self = this;
// // _local://hello.txt_
// let filePath = 'file://storage/ipcApp/' + fileName;
// // 使plus.ioresolveLocalFileSystemURL
// plus.io.resolveLocalFileSystemURL(filePath,
// function(entry) {
// //
// console.log(": " + entry.fullPath);
// let drawing = {
// url: baseUrl + item,
// fileName: fileName,
// localHave: true
// }
// self.itemDrawingList.push(drawing)
// },
// function(error) {
// //
// console.log(": " + filePath);
// let drawing = {
// url: baseUrl + item,
// fileName: fileName,
// localHave: false
// }
// self.itemDrawingList.push(drawing)
// }
// );
uni.getFileInfo({
filePath: 'file://storage/emulated/0/Android/data/com.inspur.ipcApp/apps/__UNI__B298C37/downloads/storage/ipcApp/' +
fileName,
success(res) {
let drawing = {
url: baseUrl + item,
fileName: fileName,
localHave: true
}
self.itemDrawingList.push(drawing)
},
fail(err) {
let drawing = {
url: baseUrl + item,
fileName: fileName,
localHave: false
}
self.itemDrawingList.push(drawing)
}
})
})
}
this.showDrawing = true;
},
openPopupDrawing() {
},
closePopupDrawing() {
this.showDrawing = false;
this.itemDrawingList = []
},
openPopupEquip() {
this.getEquipList();
},
closePopupEquip() {
this.showEquip = false;
},
getEquipList() {
this.ready = false;
this.treeData = [{
"id": null,
"equipName": "所有设备"
}];
getEquipTree().then((res) => {
this.treeData = this.treeData.concat(res);
this.ready = true;
})
},
handleNodeClick(obj) {
this.equipName = obj.label;
this.equipId = obj.key;
this.showEquip = false;
this.drawingList = [];
this.getDrawingList();
},
getDrawingList() {
this.finished = true;
this.queryParams.equipId = this.equipId;
listDrawing(this.queryParams).then((res) => {
this.finished = false;
this.drawingList = this.drawingList.concat(res.rows);
this.total = res.total;
})
},
}
}
</script>
<style>
/* 卡片的样式 start */
.card-group .cu-card .cu-item {
box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px;
}
.card-group .card-title {
left: 20px !important;
color: #333;
font-weight: 600;
display: flex;
justify-content: space-between;
width: calc(100% - 20px) !important;
}
.card-group .card-title .label-btn {
margin: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 16px;
border-bottom-left-radius: 16px;
letter-spacing: 1px;
}
.card-group .cu-list.menu-avatar>.cu-item {
height: 50px;
}
.card-group .cu-list.menu-avatar>.cu-item:after {
border-bottom: none !important;
}
.card-group .content-container {
padding-left: 20px;
color: #909399;
margin-bottom: 6px;
}
.card-group .content-container .text-content .iconfont {
font-size: 16px;
margin-right: 4px;
}
.card-group .content-container .text-content .text-description {
font-size: 14px;
}
.card-group .text-bottom {
margin: 0 20px;
border-top: 1px dotted #aaa;
padding: 6px 0;
}
/* 卡片的样式 end */
/* 下拉加载提示字的样式 end */
.loading-tip {
font-size: 12px;
color: #666;
padding-bottom: 12px;
text-align: center;
}
</style>

View File

@ -19,6 +19,27 @@
<u-form-item label="出厂日期:" prop="" borderBottom> <u-form-item label="出厂日期:" prop="" borderBottom>
{{equipInfo.equipProductionDate}} {{equipInfo.equipProductionDate}}
</u-form-item> </u-form-item>
<u-form-item label="设备类别:" prop="" borderBottom>
{{equipInfo.equipCategoryName}}
</u-form-item>
<u-form-item label="设备部门名称:" prop="" borderBottom>
{{equipInfo.deptName}}
</u-form-item>
<u-form-item label="安装位置:" prop="" borderBottom>
{{equipInfo.equipInstallationLocation}}
</u-form-item>
<u-form-item label="采购日期:" prop="" borderBottom>
{{equipInfo.equipPurchaseDate}}
</u-form-item>
<u-form-item label="设备价格:" prop="" borderBottom>
{{equipInfo.equipPrice}}
</u-form-item>
<u-form-item label="技术参数:" prop="" borderBottom>
{{equipInfo.equipTechnicalSpecifications}}
</u-form-item>
<u-form-item label="备注:" prop="" borderBottom>
{{equipInfo.remark}}
</u-form-item>
</u--form> </u--form>
</view> </view>
</uni-section> </uni-section>

View File

@ -20,6 +20,12 @@
<text class="text">设备档案</text> <text class="text">设备档案</text>
</view> </view>
</uni-grid-item> </uni-grid-item>
<uni-grid-item>
<view class="grid-item-box" @click="drawingClick">
<uni-icons type="images" size="30"></uni-icons>
<text class="text">设备图纸</text>
</view>
</uni-grid-item>
</uni-grid> </uni-grid>
</view> </view>
</uni-section> </uni-section>
@ -70,6 +76,9 @@
} }
}, },
methods: { methods: {
drawingClick(){
this.$tab.navigateTo("/pages/work/drawing/listDrawing");
},
equipCancelClick(){ equipCancelClick(){
this.$tab.navigateTo("/pages/work/equipCancel/listEquipCancel"); this.$tab.navigateTo("/pages/work/equipCancel/listEquipCancel");
}, },

View File

@ -58,6 +58,9 @@
</template> </template>
<script> <script>
import config from '@/config'
const baseUrl = config.baseUrl
import { import {
getPatrolDetailsById, getPatrolDetailsById,
addTaskReport addTaskReport
@ -131,7 +134,10 @@
} }
addTaskReport(data).then(() => { addTaskReport(data).then(() => {
uni.$u.toast('提交成功') uni.$u.toast('提交成功')
this.$tab.redirectTo("/pages/work/patrol/listPatrol"); uni.navigateBack({
//
delta: 1
});
this.cleanParams(); this.cleanParams();
}); });
}) })
@ -216,7 +222,7 @@
uploadFilePromise(url, flag) { uploadFilePromise(url, flag) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let a = uni.uploadFile({ let a = uni.uploadFile({
url: 'http://10.73.76.248:8080/common/upload', url: baseUrl + '/common/upload',
filePath: url, filePath: url,
name: 'file', name: 'file',
formData: {}, formData: {},