新增临界数据管理

This commit is contained in:
limengnan 2025-12-24 16:36:15 +08:00
parent db11179d81
commit 46a5554a8e
9 changed files with 1235 additions and 295 deletions

View File

@ -0,0 +1,50 @@
import request from '@/utils/request';
//获取所有项目列表
export function searchCriticalDataPage(queryParams:any){
return request({
url: '/critical-data/by-device-type' ,
method: 'get',
params:queryParams
});
}
//新增项目
export function addCriticalData(data:any){
return request({
url:'/critical-data' ,
method: 'Post',
data: data
});
}
//更新项目信息
export function updateCriticalData (queryParams:any){
return request({
url:'/critical-data' ,
method: 'PUT',
data: queryParams
});
}
//单个删除项目
export function deleteCriticalData (queryParams:any){
return request({
url:'/critical-data/'+queryParams.id ,
method: 'delete'
// params: queryParams
});
}
//多选删除项目
export function deleteBatchCriticalData (queryParams:any){
return request({
url:'/critical-data',
method: 'delete',
data: queryParams
});
}

View File

@ -0,0 +1,50 @@
import request from '@/utils/request';
//获取所有项目列表
export function searchDevicesPage(queryParams:any){
return request({
url: '/devices/search' ,
method: 'get',
params:queryParams
});
}
//新增项目
export function addDevices(data:any){
return request({
url:'/devices' ,
method: 'Post',
data: data
});
}
//更新项目信息
export function updateDevices (queryParams:any){
return request({
url:'/devices' ,
method: 'PUT',
data: queryParams
});
}
//单个删除项目
export function deleteDevices (queryParams:any){
return request({
url:'/devices/'+queryParams.id ,
method: 'delete'
// params: queryParams
});
}
//多选删除项目
export function deleteBatchDevices (queryParams:any){
return request({
url:'/devices',
method: 'delete',
data: queryParams
});
}

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'; import request from '@/utils/request';
//获取所有项目列表 //获取所有项目列表
export function searchMaterialsLsit(queryParams:any){ export function searchMaterialsPage(queryParams:any){
return request({ return request({
url: '/materials/search' , url: '/materials/search' ,
method: 'get', method: 'get',

View File

@ -52,34 +52,11 @@ function logout() {
}); });
}); });
} }
function querystrChange() {
}
const badgeval = ref(0)
const isbadge = ref(true)
var source = new EventSource(url+ `/sse/connect/` + getToken(),);
onMounted(() => { onMounted(() => {
if ("EventSource" in window) {
source.onmessage = function(e) {
if(e.data>0) {
badgeval.value = e.data
isbadge.value = false
news.value.init()
} else {
isbadge.value = true
}
};
source.onopen = function(e) {
};
source.onerror = function(e:any) {
if (e.readyState == EventSource.CLOSED) {
} else {
}
};
} else {
};
}) })
onBeforeUnmount(()=>{ onBeforeUnmount(()=>{
source.close();
}) })
</script> </script>
@ -89,21 +66,6 @@ onBeforeUnmount(()=>{
<!-- <mix-nav v-if="device !== 'mobile' && settingsStore.layout === 'mix'" /> --> <!-- <mix-nav v-if="device !== 'mobile' && settingsStore.layout === 'mix'" /> -->
<div v-if="settingsStore.layout === 'left'" class="flex justify-start"> <div v-if="settingsStore.layout === 'left'" class="flex justify-start">
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
<!--全屏 -->
<div v-if="device === 'desktop'" style="position: relative;">
<el-input class="keywords" v-model="querystr" placeholder="请输入搜索关键字" clearable
@change="querystrChange"></el-input>
<img src="@/assets/MenuIcon/top_ss.png" alt="" style="position: absolute;right: 30px;top: 10px;">
</div>
<div class="flex items-center cursor-pointer" style="margin-right:15px;margin-top: 6px;">
<el-badge :value="badgeval" :hidden="isbadge" :max="10">
<el-icon style="font-size: 22px;" @click="dialogVisible = true,news.init()"><Bell /></el-icon>
</el-badge>
</div>
<!-- 布局大小 -->
<el-tooltip content="字号大小" effect="dark" placement="bottom">
<size-select />
</el-tooltip>
<!-- 全屏 --> <!-- 全屏 -->
<el-tooltip content="全屏缩放" effect="dark" placement="bottom"> <el-tooltip content="全屏缩放" effect="dark" placement="bottom">
<screenfull id="screenfull" /> <screenfull id="screenfull" />

View File

@ -1,257 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus';
import { getMessageList, setMessageStatus, setAllMessageStatus, deleteMessageById } from '@/api/message/index'
import Page from '@/components/Pagination/page.vue'
const emit = defineEmits(['update:dialogVisible'])
const props = defineProps({
dialogVisible: {
type: Boolean
},
});
const active = ref('0')
const loading = ref(false)
const tableData = ref([])
const tableDataSel = ref([])
const isLookOver = ref(false)
const info = ref({
title: '',
createtime: '',
content: ''
})
const queryParams = ref({
current: 1,
size: 10,
title: '',
type: '',
status: active.value,
startDate: '',
endDate: ''
});
const createtime = ref('')
const total = ref()
const handleClose = () => {
emit(
'update:dialogVisible',
false
);
}
function handleSelectionChange(val: any) {
tableDataSel.value = val;
}
function reset() {
queryParams.value.title = ''
queryParams.value.type = ''
queryParams.value.startDate = ''
queryParams.value.endDate = ''
createtime.value = ''
init()
}
function init() {
loading.value = true
queryParams.value.status = active.value
if(createtime.value) {
queryParams.value.startDate = createtime.value[0]
queryParams.value.endDate = createtime.value[1]
}
if(Number(active.value) == 0) {
queryParams.value.title = ''
queryParams.value.type = ''
createtime.value = ''
}
getMessageList(queryParams.value).then((result) => {
loading.value = false
tableData.value = result.data.records
total.value = result.data.total
queryParams.value.size = result.data.size;
queryParams.value.current = result.data.current
}).catch(() => {
loading.value = false
});
}
function open(row: any) {
const id = [row.id]
setMessageStatus(id.join(',')).then(() => {
init()
})
isLookOver.value = true
info.value = JSON.parse(JSON.stringify(row))
}
function del(row:any) {
ElMessageBox.confirm(
'确定删除此消息吗',
'删除提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then( async () => {
const id = [] as any[]
if(row.id == null) {
tableDataSel.value.forEach((element:any) => {
id.push(element.id)
});
} else {
id.push(row.id)
}
deleteMessageById(id.join(',')).then(() => {
ElMessage({
message: "删除成功",
type: "success",
});
init()
})
})
}
function tabClick() {
ElMessageBox.confirm(
'确定将全部消息标记为已阅吗?',
'提示信息',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then( async () => {
setAllMessageStatus().then(() => {
ElMessage({
message: "已读成功",
type: "success",
});
init()
})
})
}
defineExpose({
init
});
onMounted(() => {
})
</script> </script>
<template> <template>
<el-dialog class="dialog" draggable v-model="props.dialogVisible" width="1100" top="3vh" append-to-body <div></div>
:before-close="handleClose" :show-close="!isLookOver">
<el-tabs v-show="!isLookOver" v-model="active" @tab-change="init" type="border-card">
<el-tab-pane label="最新消息">
</el-tab-pane>
<el-tab-pane label="历史消息">
<div class="flex justify-between mb-4">
<div class="flex items-center ">
<el-input v-model="queryParams.title" placeholder="请输入消息标题" clearable style="width: 200px;margin-right:10px" @keyup.enter="init" />
<el-select v-model="queryParams.type" clearable default-first-option placeholder="消息类型" style="width: 200px;margin-right:10px" @change="init">
<el-option label="定时任务" value="1" />
<el-option label="工作流触发" value="2" />
<el-option label="人工任务" value="3" />
</el-select>
<el-date-picker
v-model="createtime"
type="daterange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
value-format="YYYY-MM-DD"
@change="init"
/>
<el-button type="primary" style="margin-left: 10px;" @click="init">搜索</el-button>
<el-button @click="reset">重置</el-button>
</div>
<el-button :disabled="tableDataSel.length==0" type="primary" @click="del">
<span>删除</span>
</el-button>
</div>
</el-tab-pane>
<el-table v-loading="loading" :data="tableData" style="width: 100%; margin-bottom: 20px;overflow:hidden;" height="400px"
row-key="id" border @selection-change="handleSelectionChange" default-expand-all
:header-cell-style="{ background: 'rgb(250 250 250)', height: '50px' }">
<el-table-column v-if="active == '1'" type="selection" align="center" width="50" />
<el-table-column type="index" label="序号" align="center" width="70" />
<el-table-column prop="title" label="消息标题">
<template #default="scope">
<span class="title" @click="open(scope.row)">{{ scope.row.title }}</span>
</template>
</el-table-column>
<el-table-column prop="type" label="消息类型" width="100">
<template #default="scope">
{{ scope.row.type == '1' ? '定时任务' : (scope.row.type == '2' ? '工作流触发' : '人工触发') }}
</template>
</el-table-column>
<el-table-column prop="senderName" label="发送者" width="120"></el-table-column>
<el-table-column prop="createtime" label="通知时间" width="180"></el-table-column>
<el-table-column label="状态" width="180">
<template #default="scope">
<span :style="{color:scope.row.status == '2'?'rgb(55, 196, 122)':scope.row.status == '9'?'rgb(255, 153, 0)':''}">{{ scope.row.status != '1'?'●':''}} {{ scope.row.status == '1' ? '初始创建' : (scope.row.status == '2' ? '消息已阅' : '消息过期') }}</span>
</template>
</el-table-column>
<el-table-column v-if="active == '1'" fixed="right" align="center" label="操作" width="80">
<template #default="scope">
<img src="@/assets/MenuIcon/lbcz_sc.png" alt="" @click="del(scope.row)"
title="删除" style="cursor: pointer;margin-left:10px">
</template>
</el-table-column>
</el-table>
<div class="flex justify-between items-center mb-4">
<Page :total="total" v-model:size="queryParams.size" v-model:current="queryParams.current" @pagination="init()" ></Page>
<el-button v-if="active == '0'" type="primary" @click="tabClick">
<span>全部已读</span>
</el-button>
</div>
</el-tabs>
<div v-show="isLookOver" class="p-6">
<div class="flex justify-between">
<span class="font-black" style="color: #000;font-size: 20px;">{{ info.title }}</span>
<el-button type="primary" plain @click="isLookOver = false">
返回
</el-button>
</div>
<div style="height:50px;line-height: 50px;border-bottom: 1px solid #e4e4e4;">
<span style="color: rgb(148, 148, 148);font-size:14px;">{{ info.createtime }}</span>
</div>
<div style="color:rgb(80, 80, 80);font-size: 14px;padding-top:15px;overflow:auto">
{{ info.content }}
</div>
</div>
</el-dialog>
</template> </template>
<style lang="scss"> <style lang="scss">
.title{
color:rgb(64, 158, 255);
cursor: pointer;
&:hover{
text-decoration: underline;
}
}
.dialog {
height: 500px;
img {
display: inline-block;
}
.el-tabs__content,
.el-tabs--border-card {
border: none !important;
}
.el-tabs__item {
height: 50px !important;
line-height: 50px !important;
}
.el-dialog__headerbtn {
z-index: 100;
top: 0px;
}
.el-dialog__header {
padding: 0 !important;
}
.el-dialog__body {
padding: 0 !important;
}
}
</style> </style>

View File

@ -0,0 +1,494 @@
<script lang="ts">
export default {
name: "criticalData",
};
</script>
<script setup lang="ts">
import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchCriticalDataPage,addCriticalData,updateCriticalData,deleteCriticalData,deleteBatchCriticalData} from "@/api/business/database/criticalData";
import { getDictItemById } from '@/api/dict';
import Page from '@/components/Pagination/page.vue'
import { getToken } from '@/utils/auth'
const url = import.meta.env.VITE_APP_BASE_API;
//
const queryParams:any = ref({
current: 1,
size: 10,
deviceType: ''
});
//
const total = ref()
//
const customAttrsData:any = ref([])
const tableData: any = ref([]);
const multipleSelection = ref([]);
//
const loading = ref(false)
function gettableData() {
let params = {
name: input.value,
deviceType: queryParams.value.type,
pageNum: queryParams.value.current,
pageSize: queryParams.value.size,
};
loading.value = true;
searchCriticalDataPage(params).then((result:any) => {
tableData.value = result.records;
total.value = result.total;
loading.value = false;
}).catch((err) => {
loading.value = false;
});
}
//
function handleSelectionChange(val: any) {
multipleSelection.value = val;
}
const menuData:any = ref([])
//
function menuInit() {
let params = {
dictId: 'fe2c3418b8998f4e64d56ab46bfe0fed',
size:99,
current:1
}
getDictItemById(params).then((result: any) => {
menuData.value = result.data.records;
queryParams.value.type = menuData.value[0].itemCode
gettableData();
}).catch((err: any) => {
});
}
function handleMenu(row:any) {
queryParams.value.type = row.itemCode
gettableData()
}
const infoForm = ref();
//
const input = ref("");
//
const title = ref("");
const info: any = ref({
deviceType: null,
diameter: null,
height: null,
fissileConcentration: null,
isotopicAbundance: null,
extraFeatures: null,
keffValue: null,
});
const dialogVisible = ref(false);
function addClick() {
title.value = "新增设备";
info.value = {
deviceType: queryParams.value.type,
diameter: null,
height: null,
fissileConcentration: null,
isotopicAbundance: null,
extraFeatures: null,
keffValue: null,
};
customAttrsData.value = []
dialogVisible.value = true;
}
//-/
function confirmClick(formEl: any) {
formEl.validate((valid: any) => {
if (valid) {
if (!info.value.projectId) {
const params = {
projectId: -1,
...info.value,
customAttrs: JSON.stringify( customAttrsData.value)
}
addCriticalData(params).then((res) => {
gettableData();
dialogVisible.value = false;
});
} else if (info.value.projectId) {
const params = {
projectId: -1,
...info.value,
customAttrs: JSON.stringify( customAttrsData.value)
}
updateCriticalData(params).then((res) => {
gettableData();
dialogVisible.value = false;
});
} else {
return false;
}
}
});
}
//-
function handleClose() {
dialogVisible.value = false;
if (infoForm.value != null) infoForm.value.resetFields();
}
//
const rules = ref({
name: [{ required: true, message: "请输入设备名称", trigger: "blur" }],
code: [{ required: true, message: "请输入设备编码", trigger: "blur" }],
});
//
function editClick(row: any) {
title.value = "修改设备";
info.value = JSON.parse(JSON.stringify(row));
if(row.customAttrs != null){
customAttrsData.value = JSON.parse(row.customAttrs);
}
dialogVisible.value = true;
}
//
function delAloneClick(row: any) {
ElMessageBox.confirm("确定删除此设备吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let params = {
id: row.deviceId,
};
deleteCriticalData(params).then(() => {
gettableData();
ElMessage({
type: "success",
message: "删除成功",
});
});
})
}
//
function delClick() {
ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let id = [] as any[];
multipleSelection.value.forEach((item: any) => {
id.push(item.deviceId)
})
let params = {
ids: id,
};
deleteBatchCriticalData(params.ids).then(() => {
gettableData();
ElMessage({
message: "删除成功",
type: "success",
});
});
});
}
function dateFormat(row: any) {
const daterc = row;
if (daterc != null) {
var date = new Date(daterc);
var year = date.getFullYear();
var month =
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
//
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}
}
function handlePreview(){
// loadingtext.value = ""
loading.value = true
}
const upload:any = ref(null)
function handlesSuccess(file: any) {
if(file !== false){
ElMessage({
message: "导入成功!",
type: "success",
});
}else{
ElMessage({
message: "导入失败!",
type: "error",
});
}
gettableData()
upload.value.clearFiles()
}
function handleError(file: any){
loading.value = false
ElMessage({
message: "导入失败!",
type: "error",
});
upload.value.clearFiles()
}
//
function handleNumberInput(field: string) {
//
info.value[field] = info.value[field].replace(/[^\d.]/g, '');
//
const parts = info.value[field].split('.');
if (parts.length > 2) {
info.value[field] = parts[0] + '.' + parts.slice(1).join('');
}
}
onMounted(() => {
menuInit()
});
</script>
<template>
<div class="criticalData-box">
<div class="conductproject-bg-leftBox">
<div v-for="(item,index) in menuData"
:key="index" :class="{'menu-list-active': item.itemCode == queryParams.type }" class="menu-list"
@click="handleMenu(item)">
{{ item.dictName }}
</div>
</div>
<div class="conductproject-bg-box">
<div
style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between;margin-bottom: 10px">
<div style="display: flex;display: -webkit-flex;">
<el-input v-model="input" placeholder="请输入设备名称" @keyup.enter="gettableData" style="width: 200px" clearable />
<el-button type="primary" style="margin-left: 10px" @click="gettableData">搜索</el-button>
</div>
<div style="display: flex;display: -webkit-flex;">
<el-button type="primary" @click="addClick">
新增</el-button>
<el-upload
ref="upload"
accept=".xlsx,.xls"
class="upload-demo"
:action=" url + '/critical-data/import' "
:headers="{ token: getToken() }"
:show-file-list="false"
:before-upload="handlePreview"
:on-success="handlesSuccess"
:on-error="handleError">
<el-button type="primary" style="margin: 0 10px;">导入</el-button>
</el-upload>
<el-button :type="multipleSelection.length > 0 ? 'primary' : ''"
:disabled="multipleSelection.length <= 0" @click="delClick">删除</el-button>
</div>
</div>
<el-table v-loading="loading" :data="tableData" style="width: 100%; height: calc(100vh - 260px);margin-bottom: 10px;" border
@selection-change="handleSelectionChange"
:header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
<el-table-column prop="diameter" label="等效直径" min-width="100"></el-table-column>
<el-table-column prop="height" label="等效高度" min-width="100"></el-table-column>
<el-table-column prop="fissileConcentration" label="核材料浓度" min-width="100"></el-table-column>
<el-table-column prop="isotopicAbundance" label="同位素丰度" min-width="100"></el-table-column>
<el-table-column prop="keffValue" label="对应 k_eff 值" min-width="100"></el-table-column>
<el-table-column prop="modifier" label="创建人" width="120"></el-table-column>
<el-table-column prop="updatedAt" label="创建时间" width="200">
<template #default="scope">
{{ dateFormat(scope.row.updatedAt) }}
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template #default="scope">
<span
style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
<img src="@/assets/MenuIcon/lbcz_xg.png" alt="" title="修改"
@click="editClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/MenuIcon/lbcz_sc.png" alt="" title="删除"
@click="delAloneClick(scope.row)" style="cursor: pointer; ">
</span>
</template>
</el-table-column>
</el-table>
<Page :total="total" v-model:size="queryParams.size" v-model:current="queryParams.current" @pagination="gettableData()" ></Page>
</div>
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
:modal="false" draggable :before-close="handleClose" :title="title"
append-to-body width="677px" height="530px">
<el-form ref="infoForm" :model="info" :rules="rules" label-width="100px" >
<el-form-item label="等效直径" style="width: 100%;">
<el-input v-model="info.diameter" style="width: 100%" placeholder="请输入等效直径"
@input="handleNumberInput('diameter')"></el-input>
</el-form-item>
<el-form-item label="等效高度" style="width: 100%;">
<el-input v-model="info.height" style="width: 100%" placeholder="请输入等效高度"
@input="handleNumberInput('height')"></el-input>
</el-form-item>
<el-form-item label="核材料浓度" style="width: 100%;">
<el-input v-model="info.fissileConcentration" style="width: 100%" placeholder="请输入核材料浓度"
@input="handleNumberInput('fissileConcentration')">
<!-- <template #append>m</template> -->
</el-input>
</el-form-item>
<el-form-item label="同位素丰度" style="width: 100%;">
<el-input v-model="info.isotopicAbundance" style="width: 100%" placeholder="请输入同位素丰度"
@input="handleNumberInput('isotopicAbundance')">
<!-- <template #append>m</template> -->
</el-input>
</el-form-item>
<el-form-item label="对应k_eff值" style="width: 100%;">
<el-input v-model="info.keffValue" style="width: 100%" placeholder="请输入对应k_eff值"
@input="handleNumberInput('keffValue')">
<!-- <template #append>/s</template> -->
</el-input>
</el-form-item>
<span class="dialog-footer"
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="confirmClick(infoForm)"> </el-button>
</span>
</el-form>
</el-dialog>
</div>
</template>
<style scoped>
.criticalData-box {
padding-right: 10px;
display: flex;
justify-content: space-between;
}
.dialog-footer {
display: block;
margin-top: 20px;
}
.conductproject-bg-leftBox{
width: 240px;
height: calc(100vh - 130px);
overflow: auto;
padding: 20px 0px;
background-color: rgba(255, 255, 255, 1);
border: none;
border-radius: 3px;
box-sizing: border-box;
}
.menu-list{
width: 220px;
height: 40px;
line-height: 40px;
box-sizing: border-box;
padding-left: 30px;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
letter-spacing: normal;
color: #333333;
margin-left: 10px;
cursor: pointer;
}
.menu-list:hover{
background-color: #f9f9f9;
}
.menu-list-active{
background-color: #eaf1ff !important;
color: rgb(38, 111, 255) ;
}
.conductproject-bg-box {
padding: 20px;
width: calc(100% - 255px);
height: calc(100vh - 130px);
overflow: auto;
background-color: rgba(255, 255, 255, 1);
border: none;
border-radius: 3px;
box-sizing: border-box;
}
.menu-title{
width: 100%;
height: 50px;
line-height: 50px;
border-bottom: 1px solid rgba(242, 242, 242, 1);
font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 15px;
color: #363636;
padding-left: 20px;
}
</style>
<style>
.el-dialog {
padding: 0 !important;
border-radius: 10px !important;
border: 1px solid #363636 !important;
}
.el-dialog .el-dialog__header{
display: flex;
display: -webkit-flex;
justify-content: flex-start;-webkit-justify-content: flex-start;
align-items: center;-webkit-align-items: center;
padding: 10px 20px;
background-color: #f1f3f8 !important;
font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 16px;
color: #1B1B1B;
text-align: left;
border-radius: 10px 10px 0 0;
height: 50px;
}
.el-dialog .el-dialog__close{
font-size: 22px;
color: rgb(80, 80, 80);
}
.el-dialog .el-dialog__headerbtn{
display: flex;
align-items: center;
}
.el-dialog .el-dialog__body{
padding: 20px 40px !important;
}
.el-dialog .el-input{
--el-input-inner-height: 38px
}
.el-dialog .el-button{
height: 40px;
}
.el-input-group__append {
background-color: transparent !important;
border: none !important;
}
</style>

View File

@ -0,0 +1,633 @@
<script lang="ts">
export default {
name: "Device",
};
</script>
<script setup lang="ts">
import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchDevicesPage,addDevices,updateDevices,deleteDevices,deleteBatchDevices} from "@/api/business/database/device";
import { getDictItemById } from '@/api/dict';
import Page from '@/components/Pagination/page.vue'
import { getToken } from '@/utils/auth'
const url = import.meta.env.VITE_APP_BASE_API;
//
const queryParams:any = ref({
current: 1,
size: 10,
type: ''
});
//
const total = ref()
//
const tableData: any = ref([]);
const multipleSelection = ref([]);
//
const loading = ref(false)
function gettableData() {
let params = {
name: input.value,
type: queryParams.value.type,
pageNum: queryParams.value.current,
pageSize: queryParams.value.size,
};
loading.value = true;
searchDevicesPage(params).then((result:any) => {
tableData.value = result.records;
total.value = result.total;
loading.value = false;
}).catch((err) => {
loading.value = false;
});
}
//
function handleSelectionChange(val: any) {
multipleSelection.value = val;
}
const menuData:any = ref([])
//
function menuInit() {
let params = {
dictId: 'fe2c3418b8998f4e64d56ab46bfe0fed',
size:99,
current:1
}
getDictItemById(params).then((result: any) => {
menuData.value = result.data.records;
queryParams.value.type = menuData.value[0].itemCode
gettableData();
}).catch((err: any) => {
});
}
function handleMenu(row:any) {
queryParams.value.type = row.itemCode
gettableData()
}
const infoForm = ref();
//
const input = ref("");
//
const title = ref("");
const info: any = ref({
name: "",
code: "",
type: null,
size: null,
volume: null,
flowRate: null,
pulseVelocity: null
});
const dialogVisible = ref(false);
function addClick() {
title.value = "新增设备";
info.value = {
name: "",
code: "",
type: queryParams.value.type,
size: null,
volume: null,
flowRate: null,
pulseVelocity: null
};
josnInfo.value = {}
if(queryParams.value.type == 'ExtractionColumn'){
josnInfo.value = {
tray_section:{},
lower_expanded:{},
upper_expanded:{}
}
}else if(queryParams.value.type == 'FluidizedBed'){
josnInfo.value = {
expanded_section:{},
reaction_section:{},
transition_section:{}
}
}else if(queryParams.value.type == 'ACFTank'){
josnInfo.value = {
frustum_bottom:{},
annular_cylinder:{}
}
}
dialogVisible.value = true;
}
//-/
function confirmClick(formEl: any) {
formEl.validate((valid: any) => {
if (valid) {
if (!info.value.projectId) {
const params = {
projectId: -1,
...info.value,
size: JSON.stringify( josnInfo.value),
}
addDevices(params).then((res) => {
gettableData();
dialogVisible.value = false;
});
} else if (info.value.projectId) {
const params = {
projectId: -1,
...info.value,
size: JSON.stringify( josnInfo.value)
}
updateDevices(params).then((res) => {
gettableData();
dialogVisible.value = false;
});
} else {
return false;
}
}
});
}
//-
function handleClose() {
dialogVisible.value = false;
if (infoForm.value != null) infoForm.value.resetFields();
}
//
const rules = ref({
name: [{ required: true, message: "请输入设备名称", trigger: "blur" }],
code: [{ required: true, message: "请输入设备编码", trigger: "blur" }],
});
//
function editClick(row: any) {
title.value = "修改设备";
info.value = JSON.parse(JSON.stringify(row));
if(row.size != null){
josnInfo.value = JSON.parse(row.size);
}
dialogVisible.value = true;
}
//
function delAloneClick(row: any) {
ElMessageBox.confirm("确定删除此设备吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let params = {
id: row.deviceId,
};
deleteDevices(params).then(() => {
gettableData();
ElMessage({
type: "success",
message: "删除成功",
});
});
})
}
//
function delClick() {
ElMessageBox.confirm("确定删除已选择角色吗?", "删除提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
}).then(() => {
let id = [] as any[];
multipleSelection.value.forEach((item: any) => {
id.push(item.deviceId)
})
let params = {
ids: id,
};
deleteBatchDevices(params.ids).then(() => {
gettableData();
ElMessage({
message: "删除成功",
type: "success",
});
});
});
}
function dateFormat(row: any) {
const daterc = row;
if (daterc != null) {
var date = new Date(daterc);
var year = date.getFullYear();
var month =
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
//
return year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds;
}
}
function handlePreview(){
// loadingtext.value = ""
loading.value = true
}
const upload:any = ref(null)
function handlesSuccess(file: any) {
if(file !== false){
ElMessage({
message: "导入成功!",
type: "success",
});
}else{
ElMessage({
message: "导入失败!",
type: "error",
});
}
gettableData()
upload.value.clearFiles()
}
function handleError(file: any){
loading.value = false
ElMessage({
message: "导入失败!",
type: "error",
});
upload.value.clearFiles()
}
const josnInfo:any = ref({})
onMounted(() => {
menuInit()
});
</script>
<template>
<div class="Device-box">
<div class="conductproject-bg-leftBox">
<div class="menu-title">
设备类型
</div>
<div v-for="(item,index) in menuData"
:key="index" :class="{'menu-list-active': item.itemCode == queryParams.type }" class="menu-list"
@click="handleMenu(item)">
{{ item.dictName }}
</div>
</div>
<div class="conductproject-bg-box">
<div
style="display: flex;display: -webkit-flex; justify-content: space-between; -webkit-justify-content: space-between;margin-bottom: 10px">
<div style="display: flex;display: -webkit-flex;">
<el-input v-model="input" placeholder="请输入设备名称" @keyup.enter="gettableData" style="width: 200px" clearable />
<el-button type="primary" style="margin-left: 10px" @click="gettableData">搜索</el-button>
</div>
<div style="display: flex;display: -webkit-flex;">
<el-button type="primary" @click="addClick">
新增</el-button>
<el-upload
ref="upload"
accept=".xlsx,.xls"
class="upload-demo"
:action=" url + '/devices/import' "
:headers="{ token: getToken() }"
:show-file-list="false"
:before-upload="handlePreview"
:on-success="handlesSuccess"
:on-error="handleError">
<el-button type="primary" style="margin: 0 10px;">导入</el-button>
</el-upload>
<el-button :type="multipleSelection.length > 0 ? 'primary' : ''"
:disabled="multipleSelection.length <= 0" @click="delClick">删除</el-button>
</div>
</div>
<el-table v-loading="loading" :data="tableData" style="width: 100%; height: calc(100vh - 260px);margin-bottom: 10px;" border
@selection-change="handleSelectionChange"
:header-cell-style="{ background: 'rgb(250 250 250)', color: '#383838', height: '50px' }">
<el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" label="序号" width="70" align="center"></el-table-column>
<el-table-column prop="name" label="设备名称" min-width="180"></el-table-column>
<!-- <el-table-column prop="description" label="设备描述" min-width="100"></el-table-column> -->
<el-table-column prop="modifier" label="创建人" width="120"></el-table-column>
<el-table-column prop="updatedAt" label="创建时间" width="200">
<template #default="scope">
{{ dateFormat(scope.row.updatedAt) }}
</template>
</el-table-column>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template #default="scope">
<span
style="display: flex;display: -webkit-flex; justify-content: space-around;-webkit-justify-content: space-around; ">
<img src="@/assets/MenuIcon/lbcz_xg.png" alt="" title="修改"
@click="editClick(scope.row)" style="cursor: pointer; ">
<img src="@/assets/MenuIcon/lbcz_sc.png" alt="" title="删除"
@click="delAloneClick(scope.row)" style="cursor: pointer; ">
</span>
</template>
</el-table-column>
</el-table>
<Page :total="total" v-model:size="queryParams.size" v-model:current="queryParams.current" @pagination="gettableData()" ></Page>
</div>
<el-dialog v-model="dialogVisible" :close-on-click-modal="false"
:modal="false" draggable :before-close="handleClose" :title="title"
append-to-body width="677px" height="530px">
<el-form ref="infoForm" :model="info" :rules="rules" label-width="120px" v-if="dialogVisible == true">
<el-form-item label="设备编号" prop="code" style="width: 100%;">
<el-input v-model="info.code" style="width: 100%" placeholder="请输入设备编号"></el-input>
</el-form-item>
<el-form-item label="设备名称" prop="name" style="width: 100%;">
<el-input v-model="info.name" style="width: 100%" placeholder="请输入设备名称"></el-input>
</el-form-item>
<div v-if="queryParams.type == 'FlatTank'">
<el-form-item label="长度" style="width: 100%;">
<el-input v-model="josnInfo['length']" style="width: 100%" placeholder="请输入长度">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="宽度" style="width: 100%;">
<el-input v-model="josnInfo.width" style="width: 100%" placeholder="请输入宽度">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="高度" style="width: 100%;">
<el-input v-model="josnInfo.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
</div>
<div v-if="queryParams.type == 'CylindricalTank'">
<el-form-item label="直径" style="width: 100%;">
<el-input v-model="josnInfo.diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="高度" style="width: 100%;">
<el-input v-model="josnInfo.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
</div>
<div v-if="queryParams.type == 'AnnularTank'">
<el-form-item label="环形槽外径" style="width: 100%;">
<el-input v-model="josnInfo.outer_diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="高度" style="width: 100%;">
<el-input v-model="josnInfo.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
</div>
<div v-if="queryParams.type == 'TubeBundleTank'">
<el-form-item label="管束槽外径" style="width: 100%;">
<el-input v-model="josnInfo.outer_diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="高度" style="width: 100%;">
<el-input v-model="josnInfo.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
</div>
<div v-if="queryParams.type == 'ExtractionColumn'">
<el-form-item label="上扩大段直径" style="width: 100%;">
<el-input v-model="josnInfo.upper_expanded.diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="上扩大段高度" style="width: 100%;">
<el-input v-model="josnInfo.upper_expanded.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="板段直径" style="width: 100%;">
<el-input v-model="josnInfo.tray_section.diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="板段高度" style="width: 100%;">
<el-input v-model="josnInfo.tray_section.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="下扩大段直径" style="width: 100%;">
<el-input v-model="josnInfo.lower_expanded.diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="下扩大段高度" style="width: 100%;">
<el-input v-model="josnInfo.lower_expanded.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
</div>
<div v-if="queryParams.type == 'FluidizedBed'">
<el-form-item label="扩大段直径" style="width: 100%;">
<el-input v-model="josnInfo.expanded_section.diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="扩大段高度" style="width: 100%;">
<el-input v-model="josnInfo.expanded_section.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="反应段直径" style="width: 100%;">
<el-input v-model="josnInfo.reaction_section.diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="反应段高度" style="width: 100%;">
<el-input v-model="josnInfo.reaction_section.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="过渡段高度" style="width: 100%;">
<el-input v-model="josnInfo.transition_section.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
</div>
<div v-if="queryParams.type == 'ACFTank'">
<el-form-item label="环形圆柱外径" style="width: 100%;">
<el-input v-model="josnInfo.annular_cylinder.outer_diameter" style="width: 100%" placeholder="请输入外径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="环形圆柱高度" style="width: 100%;">
<el-input v-model="josnInfo.annular_cylinder.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="圆锥台底部直径" style="width: 100%;">
<el-input v-model="josnInfo.frustum_bottom.bottom_diameter" style="width: 100%" placeholder="请输入直径">
<template #append>cm</template>
</el-input>
</el-form-item>
<el-form-item label="圆锥台底部高度" style="width: 100%;">
<el-input v-model="josnInfo.frustum_bottom.height" style="width: 100%" placeholder="请输入高度">
<template #append>cm</template>
</el-input>
</el-form-item>
</div>
<el-form-item label="容量" style="width: 100%;">
<el-input v-model="info.volume" style="width: 100%" placeholder="请输入容量">
<template #append>L</template>
</el-input>
</el-form-item>
<el-form-item label="流量" style="width: 100%;">
<el-input v-model="info.flowRate" style="width: 100%" placeholder="请输入流量">
<template #append>/h</template>
</el-input>
</el-form-item>
<el-form-item label="脉冲速度" style="width: 100%;">
<el-input v-model="info.pulseVelocity" style="width: 100%" placeholder="请输入脉冲速度">
<template #append>Hz</template>
</el-input>
</el-form-item>
<span class="dialog-footer"
style="display: flex;display: -webkit-flex; justify-content: flex-end;-webkit-justify-content: flex-end;">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="confirmClick(infoForm)"> </el-button>
</span>
</el-form>
</el-dialog>
</div>
</template>
<style scoped>
.Device-box {
padding-right: 10px;
display: flex;
justify-content: space-between;
}
.dialog-footer {
display: block;
margin-top: 20px;
}
.conductproject-bg-leftBox{
width: 240px;
height: calc(100vh - 130px);
overflow: auto;
padding: 0px 0px;
background-color: rgba(255, 255, 255, 1);
border: none;
border-radius: 3px;
box-sizing: border-box;
}
.menu-list{
width: 220px;
height: 40px;
line-height: 40px;
box-sizing: border-box;
padding-left: 30px;
font-family: 'Arial Normal', 'Arial', sans-serif;
font-weight: 400;
font-style: normal;
font-size: 14px;
letter-spacing: normal;
color: #333333;
margin-left: 10px;
cursor: pointer;
}
.menu-list:hover{
background-color: #f9f9f9;
}
.menu-list-active{
background-color: #eaf1ff !important;
color: rgb(38, 111, 255) ;
}
.conductproject-bg-box {
padding: 20px;
width: calc(100% - 255px);
height: calc(100vh - 130px);
overflow: auto;
background-color: rgba(255, 255, 255, 1);
border: none;
border-radius: 3px;
box-sizing: border-box;
}
.menu-title{
width: 100%;
height: 50px;
line-height: 50px;
border-bottom: 1px solid rgba(242, 242, 242, 1);
font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 15px;
color: #363636;
padding-left: 20px;
}
</style>
<style>
.el-dialog {
padding: 0 !important;
border-radius: 10px !important;
border: 1px solid #363636 !important;
}
.el-dialog .el-dialog__header{
display: flex;
display: -webkit-flex;
justify-content: flex-start;-webkit-justify-content: flex-start;
align-items: center;-webkit-align-items: center;
padding: 10px 20px;
background-color: #f1f3f8 !important;
font-family: 'Arial Negreta', 'Arial Normal', 'Arial', sans-serif;
font-weight: 700;
font-style: normal;
font-size: 16px;
color: #1B1B1B;
text-align: left;
border-radius: 10px 10px 0 0;
height: 50px;
}
.el-dialog .el-dialog__close{
font-size: 22px;
color: rgb(80, 80, 80);
}
.el-dialog .el-dialog__headerbtn{
display: flex;
align-items: center;
}
.el-dialog .el-dialog__body{
padding: 20px 40px !important;
}
.el-dialog .el-input{
--el-input-inner-height: 38px
}
.el-dialog .el-button{
height: 40px;
}
.el-input-group__append {
background-color: transparent !important;
border: none !important;
}
</style>

View File

@ -7,7 +7,7 @@ export default {
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, nextTick } from "vue"; import { onMounted, ref, nextTick } from "vue";
import { ElForm, ElMessage, ElMessageBox } from "element-plus"; import { ElForm, ElMessage, ElMessageBox } from "element-plus";
import { searchMaterialsLsit,addMaterials,updateMaterials,deleteMaterials,deleteBatchMaterials} from "@/api/business/database/material"; import { searchMaterialsPage,addMaterials,updateMaterials,deleteMaterials,deleteBatchMaterials} from "@/api/business/database/material";
import Page from '@/components/Pagination/page.vue' import Page from '@/components/Pagination/page.vue'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
const url = import.meta.env.VITE_APP_BASE_API; const url = import.meta.env.VITE_APP_BASE_API;
@ -34,7 +34,7 @@ function gettableData() {
pageSize: queryParams.value.size, pageSize: queryParams.value.size,
}; };
loading.value = true; loading.value = true;
searchMaterialsLsit(params).then((result:any) => { searchMaterialsPage(params).then((result:any) => {
tableData.value = result.records; tableData.value = result.records;
total.value = result.total; total.value = result.total;
loading.value = false; loading.value = false;
@ -315,7 +315,7 @@ onMounted(() => {
新增</el-button> 新增</el-button>
<el-upload <el-upload
ref="upload" ref="upload"
accept=".xlsx" accept=".xlsx,.xls"
class="upload-demo" class="upload-demo"
:action=" url + '/materials/import' " :action=" url + '/materials/import' "
:headers="{ token: getToken() }" :headers="{ token: getToken() }"

View File

@ -784,7 +784,7 @@ onMounted(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.detail-box { .detail-box {
width: 100%; width: 100%;
height: calc(100vh - 120px); height: calc(100vh - 130px);
overflow: auto; overflow: auto;
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
border: none; border: none;