设备台账:添加文件删除,添加基础字段所属工程,列表从枚举值获取,调整显示结构
This commit is contained in:
parent
84151f6f01
commit
d3df394115
@ -178,13 +178,26 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属线路:">
|
||||
<el-input placeholder="请输入所属线路" v-model="deviceData.belongLine" style="width: 200px" />
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="9">
|
||||
<el-form-item label="所属工程">
|
||||
<el-select placeholder="请选择所属工程" v-model="deviceData.belongProject">
|
||||
<el-option v-for="item in belongprojectList" :key="item.id" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="10" :offset="1">
|
||||
<el-button @click="openAttachment('风机')">风机详情</el-button>
|
||||
<el-col :span="9">
|
||||
<el-form-item label="所属线路:">
|
||||
<el-select placeholder="请选择所属线路" v-model="deviceData.belongLine">
|
||||
<el-option v-for="item in belongLineList" :key="item.id" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3">
|
||||
<div style="padding-left: 26px; width: 100%; height: 100%">
|
||||
<el-button @click.stop="openAttachment('风机')">风机详情</el-button>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
@ -274,7 +287,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('变桨')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('变桨')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="叶片1型号:">
|
||||
@ -287,7 +300,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('叶片1')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('叶片1')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="叶片1轴承型号:">
|
||||
@ -310,7 +323,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('叶片2')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('叶片2')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="叶片2轴承型号:">
|
||||
@ -333,7 +346,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('叶片3')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('叶片3')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="叶片3轴承型号:">
|
||||
@ -356,7 +369,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('主轴承')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('主轴承')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="齿轮箱型号:">
|
||||
@ -369,7 +382,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('齿轮箱')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('齿轮箱')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="发电机型号:">
|
||||
@ -382,7 +395,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('发电机')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('发电机')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-form-item label="交流器型号:">
|
||||
@ -395,7 +408,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" :offset="1">
|
||||
<el-button @click="openAttachment('交流器')">详情…</el-button>
|
||||
<el-button @click.stop="openAttachment('交流器')">详情…</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="主控系统型号:">
|
||||
@ -413,10 +426,10 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button @click="openAttachment('塔基柜')">塔基柜详情</el-button>
|
||||
<el-button @click.stop="openAttachment('塔基柜')">塔基柜详情</el-button>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button @click="openAttachment('机舱柜')">机舱柜详情</el-button>
|
||||
<el-button @click.stop="openAttachment('机舱柜')">机舱柜详情</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
@ -635,7 +648,13 @@
|
||||
preview-teleported
|
||||
style="width: 100%; height: 100%"
|
||||
></el-image>
|
||||
<!-- <img :src="item.url" alt="" style="width: auto; height: 100%" /> -->
|
||||
<div class="delImg">
|
||||
<el-popconfirm title="确认删除该图片吗?" @confirm="delImg(item)">
|
||||
<template #reference>
|
||||
<el-button @click.stop type="danger" :icon="CloseBold" circle />
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</div>
|
||||
</div>
|
||||
</el-carousel-item>
|
||||
</template>
|
||||
@ -648,7 +667,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, computed, onMounted, nextTick, watch } from 'vue'
|
||||
import { Search, CirclePlusFilled, Upload, Download } from '@element-plus/icons-vue'
|
||||
import { Search, CirclePlusFilled, Upload, Download, CloseBold } from '@element-plus/icons-vue'
|
||||
import {
|
||||
equipTree,
|
||||
equipQuery,
|
||||
@ -666,12 +685,7 @@ import {
|
||||
delOtherParamsReq,
|
||||
uploadOtherParamsFileReq,
|
||||
} from '/@/api/backend'
|
||||
import {
|
||||
ElTable,
|
||||
ElMessage,
|
||||
ElMessageBox,
|
||||
FormInstance,
|
||||
} from 'element-plus'
|
||||
import { ElTable, ElMessage, ElMessageBox, FormInstance } from 'element-plus'
|
||||
import { useAdminInfo } from '/@/stores/adminInfo'
|
||||
import { encrypt_aes, generateRandomNumber } from '/@/utils/crypto'
|
||||
import ControlPage from './control.vue'
|
||||
@ -680,6 +694,7 @@ import { ModelAttributeType } from '/@/views/backend/auth/model/type'
|
||||
import { theoreticalpowerCurveList } from '/@/api/backend/theoreticalpowerCurve/request'
|
||||
import CustomUpload from '/@/components/upload/index.vue'
|
||||
import { permission } from '/@/utils/directive'
|
||||
import { enumListQuery } from '/@/api/backend/Enumeration/request'
|
||||
const vPermission = permission()
|
||||
|
||||
const adminInfo = useAdminInfo()
|
||||
@ -785,10 +800,26 @@ const defaultEquipmentProps = {
|
||||
children: 'equipChildren',
|
||||
}
|
||||
|
||||
const belongLineList = ref<{ value: string;id:string }[]>([])
|
||||
const belongprojectList = ref<{ value: string;id:string }[]>([])
|
||||
const getEnumList = () => {
|
||||
enumListQuery({ enumTypeId: '1872545505561620482' }).then((res) => {
|
||||
belongprojectList.value = res.data.rows.map((item: { description: string; id: string }) => {
|
||||
return { id: item.id, value: item.description }
|
||||
})
|
||||
})
|
||||
enumListQuery({ enumTypeId: '1872549920439873537' }).then((res) => {
|
||||
belongLineList.value = res.data.rows.map((item: { description: string; id: string }) => {
|
||||
return { id: item.id, value: item.description }
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
equipTypeList()
|
||||
equipOrgList()
|
||||
equipOrgBelonging()
|
||||
getEnumList()
|
||||
})
|
||||
|
||||
const formQuery = reactive({
|
||||
@ -1234,6 +1265,7 @@ const originDeviceData: any = {
|
||||
orgId: '',
|
||||
parentEquipmentId: '',
|
||||
iotModelId: '',
|
||||
belongProject: '',
|
||||
belongLine: '',
|
||||
standard: 0,
|
||||
nominalCapacity: '',
|
||||
@ -1340,9 +1372,10 @@ const saveDeviceData = () => {
|
||||
}
|
||||
})
|
||||
}
|
||||
const beforeCloseType10002Dialog = (done: () => void) =>{
|
||||
if (addImgList.value.length) {
|
||||
ElMessageBox.confirm('上传图片未保存,确认取消?', '', {
|
||||
const beforeCloseType10002Dialog = (done: () => void) => {
|
||||
if (addImgList.value.length || delImgState.value) {
|
||||
const title = delImgState.value ? '删除图片未保存,确认取消?' : '上传图片未保存,确认取消?'
|
||||
ElMessageBox.confirm(title, '', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
@ -1351,6 +1384,7 @@ const beforeCloseType10002Dialog = (done: () => void) =>{
|
||||
done()
|
||||
addImgList.value = []
|
||||
imgList.value = []
|
||||
delImgState.value = false
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
@ -1359,8 +1393,9 @@ const beforeCloseType10002Dialog = (done: () => void) =>{
|
||||
}
|
||||
}
|
||||
const cancelType10002Dialog = () => {
|
||||
if (addImgList.value.length) {
|
||||
ElMessageBox.confirm('上传图片未保存,确认取消?', '', {
|
||||
if (addImgList.value.length || delImgState.value) {
|
||||
const title = delImgState.value ? '删除图片未保存,确认取消?' : '上传图片未保存,确认取消?'
|
||||
ElMessageBox.confirm(title, '', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
@ -1369,6 +1404,7 @@ const cancelType10002Dialog = () => {
|
||||
type10002DialogVisible.value = false
|
||||
addImgList.value = []
|
||||
imgList.value = []
|
||||
delImgState.value = false
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
@ -1425,7 +1461,7 @@ const attachmentDialogVisible = ref(false)
|
||||
const attachmentDialogTitle = ref('风机详细信息')
|
||||
|
||||
const customUploadRef = ref()
|
||||
const uploadAttachmentLoading =ref(false)
|
||||
const uploadAttachmentLoading = ref(false)
|
||||
const uploadAttachment = (files: FileList) => {
|
||||
uploadAttachmentLoading.value = true
|
||||
const formData = new FormData()
|
||||
@ -1435,7 +1471,7 @@ const uploadAttachment = (files: FileList) => {
|
||||
const v = generateRandomNumber(16)
|
||||
return uploadOtherParamsFileReq(formData, v).then((res) => {
|
||||
customUploadRef.value?.clearFiles()
|
||||
res.data.forEach((item:{ name:string, url:string})=>{
|
||||
res.data.forEach((item: { name: string; url: string }) => {
|
||||
addImgList.value.push({
|
||||
name: item.name,
|
||||
url: item.url,
|
||||
@ -1461,14 +1497,19 @@ const openAttachment = (type: string) => {
|
||||
const list = otherParamsForm.sysEquipmentDocsList.filter((item: { component: string; name: string; url: string }) => {
|
||||
return item.component === type
|
||||
})
|
||||
if (list.length) {
|
||||
previewImg(list)
|
||||
const addList = addImgList.value.filter((item: { component: string }) => {
|
||||
return item.component === type
|
||||
})
|
||||
const allList = [...list, ...addList]
|
||||
if (allList.length) {
|
||||
previewImg(allList)
|
||||
} else {
|
||||
imgList.value = []
|
||||
}
|
||||
}
|
||||
const reg = /\/thumbnailPic\//
|
||||
const hasPathReg = /\/api\/equipment\/file\/read\?path=/
|
||||
const readImgAddPath = '/api/equipment/file/read?path='
|
||||
const previewImg = (list: { url: string }[]) => {
|
||||
const picList: any = []
|
||||
for (let item of list) {
|
||||
@ -1477,7 +1518,7 @@ const previewImg = (list: { url: string }[]) => {
|
||||
continue
|
||||
}
|
||||
if (reg.test(item.url)) {
|
||||
picList.push({ url: '/api/equipment/file/read?path=' + item.url })
|
||||
picList.push({ url: readImgAddPath + item.url })
|
||||
}
|
||||
}
|
||||
imgList.value = picList
|
||||
@ -1495,7 +1536,29 @@ const previewImgIndex = ref(0)
|
||||
const changeImgIndex = (index: number) => {
|
||||
previewImgIndex.value = index
|
||||
}
|
||||
|
||||
const delImgState = ref(false)
|
||||
const delImg = (imgData: { url: string }) => {
|
||||
imgList.value.splice(previewImgIndex.value, 1)
|
||||
const hasThumbnailPicOnImgList = otherParamsForm.sysEquipmentDocsList.findIndex(
|
||||
(item: { url: string }) => readImgAddPath + item.url === imgData.url
|
||||
)
|
||||
if (hasThumbnailPicOnImgList !== -1) {
|
||||
otherParamsForm.sysEquipmentDocsList.splice(hasThumbnailPicOnImgList, 1)
|
||||
const originPic = otherParamsForm.sysEquipmentDocsList.findIndex(
|
||||
(item: { url: string }) => readImgAddPath + item.url === imgData.url.replace(/\/thumbnailPic\//, '/pic/')
|
||||
)
|
||||
otherParamsForm.sysEquipmentDocsList.splice(originPic, 1)
|
||||
delImgState.value = true
|
||||
}
|
||||
const hasThumbnailPicOnAddImgList = addImgList.value.findIndex((item: { url: string }) => readImgAddPath + item.url === imgData.url)
|
||||
if (hasThumbnailPicOnAddImgList !== -1) {
|
||||
addImgList.value.splice(hasThumbnailPicOnImgList, 1)
|
||||
const originPic = addImgList.value.findIndex(
|
||||
(item: { url: string }) => readImgAddPath + item.url === imgData.url.replace(/\/thumbnailPic\//, '/pic/')
|
||||
)
|
||||
addImgList.value.splice(originPic, 1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@ -1632,11 +1695,30 @@ $paginationHeight: 32px;
|
||||
width: 100%;
|
||||
height: 305px;
|
||||
.imgContainer {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
&:hover {
|
||||
.delImg {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.delImg {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
.el-button {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user