feat(ems):优化字典数据获取方式并调整图表布局

- 将多个组件中的字典数据获取方式从 dicts 属性改为 computed 计算属性
- 统一使用 useDict 方法返回的具体字段值,提高代码一致性
- 调整部分图表组件的 grid.top 属性值,优化图表展示效果
- 在 baseEnergyPrice 组件中将 energyId 默认值设为 null
-为 reportPointSteam 模块新增增删改查 API 接口
- 修复多个组件中按钮图标与文字之间的空格问题
- 更新表单查询区域的 label-width 样式配置
- 移除 baseEnergyType 组件中的注释代码块
master
zangch@mesnac.com 3 months ago
parent b272406007
commit 463bd95b33

@ -54,3 +54,29 @@ export function pointSteamInstantList(query) {
params: query
})
}
// 新增蒸汽整点数据
export function addReportPointSteam(data) {
return request({
url: '/ems/report/reportPointSteam',
method: 'post',
data: data
})
}
// 修改蒸汽整点数据
export function updateReportPointSteam(data) {
return request({
url: '/ems/report/reportPointSteam',
method: 'put',
data: data
})
}
// 删除蒸汽整点数据
export function delReportPointSteam(objId) {
return request({
url: '/ems/report/reportPointSteam/' + objId,
method: 'delete'
})
}

@ -49,7 +49,7 @@
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['ems/base:baseCollectDeviceInfo:add']"
>新增
@ -60,7 +60,7 @@
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['ems/base:baseCollectDeviceInfo:edit']"
@ -72,7 +72,7 @@
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['ems/base:baseCollectDeviceInfo:remove']"
@ -84,7 +84,7 @@
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['ems/base:baseCollectDeviceInfo:export']"
>导出
@ -117,7 +117,7 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="100">
<template #default="scope">
<el-button
type="text"
icon="Edit"
@click="handleUpdate(scope.row)"
@ -125,7 +125,7 @@
>修改
</el-button>
<el-button
type="text"
icon="Delete"
@click="handleDelete(scope.row)"
@ -220,7 +220,11 @@ import { getBaseEnergyTypeList } from '@/api/ems/base/baseEnergyType'
export default {
name: 'BaseCollectDeviceInfo',
dicts: ['is_flag'],
computed: {
is_flag() {
return this.useDict('is_flag').is_flag;
}
},
data() {
return {
//

@ -60,7 +60,7 @@
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['ems/base:baseEnergyPrice:add']"
>新增
@ -71,7 +71,7 @@
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['ems/base:baseEnergyPrice:edit']"
@ -83,7 +83,7 @@
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['ems/base:baseEnergyPrice:remove']"
@ -95,7 +95,7 @@
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['ems/base:baseEnergyPrice:export']"
>导出
@ -135,7 +135,7 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
type="text"
icon="Edit"
@click="handleUpdate(scope.row)"
@ -143,7 +143,7 @@
>修改
</el-button>
<el-button
type="text"
icon="Delete"
@click="handleDelete(scope.row)"
@ -257,7 +257,7 @@ const energyTypeList = ref<any[]>([]);
const queryParams = ref<any>({
pageNum: 1,
pageSize: 10,
energyId: 2,
energyId: null,
energyName: null,
measureUnit: null,
monthDate: null,

@ -3,7 +3,7 @@
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
<div v-show="showSearch" class="mb-[10px]">
<el-card shadow="hover">
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="120px">
<el-form-item label="能源类型名称" prop="energyName">
<el-input
v-model="queryParams.energyName"
@ -22,14 +22,14 @@
</transition>
<el-card shadow="never">
<template #header>
<!-- <template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport" v-hasPermi="['ems:baseEnergyType:export']"></el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true" @queryTable="getList"></right-toolbar>
</el-row>
</template>
</template>-->
<el-table v-loading="loading" :data="baseEnergyTypeList" @selection-change="handleSelectionChange">
<el-table-column label="自增标识" align="center" prop="objId" v-if="columns[0].visible"/>

@ -240,11 +240,11 @@ export default {
name: 'BaseMonitorInfo',
computed: {
is_ammeter() {
return this.useDict('is_ammeter');
return this.useDict('is_ammeter').is_ammeter;
},
monitor_status() {
return this.useDict('monitor_status');
return this.useDict('monitor_status').monitor_status;
}
},

@ -228,6 +228,15 @@ import Treeselect from 'vue3-treeselect';
export default {
name: "BaseMonitorInfo",
dicts: ['is_ammeter', 'monitor_status'],
computed: {
is_ammeter() {
return this.useDict('is_ammeter').is_ammeter;
},
monitor_status() {
return this.useDict('monitor_status').monitor_status;
},
},
components: {
Treeselect
},

@ -256,6 +256,11 @@ import { getMonitorInfoTree } from '@/api/ems/base/baseMonitorInfo'
export default {
name: 'BaseMonitorThreshold',
dicts: ['monitor_type'],
computed: {
monitor_type() {
return this.useDict('monitor_type').monitor_type;
},
},
data() {
return {
//List

@ -290,6 +290,21 @@ import { getWorkUnitTrees } from '@/api/ems/base/baseWorkUnit'
export default {
name: 'BaseMonitorWorkUnit',
dicts: ['formula_mode', 'is_flag', 'monitor_status','monitor_type'],
computed: {
monitor_type() {
return this.useDict('monitor_type').monitor_type;
},
formula_mode() {
return this.useDict('formula_mode').formula_mode;
},
is_flag() {
return this.useDict('is_flag').is_flag;
},
monitor_status() {
return this.useDict('monitor_status').monitor_status;
},
},
components: {
Treeselect
},

@ -175,7 +175,11 @@ import 'vue3-treeselect/dist/vue3-treeselect.css';
export default {
name: 'BaseWorkUnit',
dicts: ['is_flag'],
computed: {
is_flag() {
return this.useDict('is_flag').is_flag;
}
},
components: {
Treeselect
},

@ -316,11 +316,11 @@ export default {
},
computed: {
ems_alarm_status() {
return this.useDict('ems_alarm_status');
return this.useDict('ems_alarm_status').ems_alarm_status;
},
alarm_type() {
return this.useDict('alarm_type');
return this.useDict('alarm_type').alarm_type;
}
},

@ -318,7 +318,7 @@ export default {
},
computed: {
collect_type() {
return this.useDict('collect_type');
return this.useDict('collect_type').collect_type;
}
},
watch: {

@ -1,368 +0,0 @@
<template>
<div class="p-2">
<el-row :gutter="28">
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="workUnitName"
placeholder="请输入物联网设备名称"
clearable
prefix-icon="Search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="monitorInfoOptions"
:props="monitorProps"
ref="tree"
show-checkbox
node-key="code"
:check-strictly="true"
default-expand-all
:expand-on-click-node="false"
highlight-current
@check="handleNodeClick">
</el-tree>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"
label-width="100px"
>
<!-- <el-form-item label="计量设备编号" prop="monitorCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.monitorCode"-->
<!-- placeholder="请输入计量设备编号"-->
<!-- clearable-->
<!-- @keyup.enter="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="采集时间">
<el-date-picker
v-model="daterangeCollectTime"
style="width: 340px"
value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- <div v-for="item in list" class="chart">-->
<!-- <Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart(item)"/>-->
<!-- <div class="title">{{item.monitorName}}</div>-->
<!-- </div>-->
<div class="chart">
<Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart()"/>
</div>
</el-col>
</el-row>
</div>
</template>
<script setup lang="ts" name="TemperatureHumidityMonitoring2">
import { ref, reactive, watch, onMounted, getCurrentInstance } from 'vue';
import { getMonitorInfoTree } from '@/api/ems/base/baseMonitorInfo';
import { iotInstantMonitoring } from '@/api/ems/report/TemperatureHumidityMonitoring';
import { parseTime } from '@/utils/ruoyi';
import Chart from '@/components/chart.vue';
import * as echarts from 'echarts';
import type { ElTree } from 'element-plus';
const { proxy } = getCurrentInstance() as any;
const tree = ref<InstanceType<typeof ElTree>>();
const queryFormRef = ref();
const list = ref<any[]>([]);
const monitorInfoOptions = ref<any[]>([]);
const workUnitName = ref<string>();
const daterangeCollectTime = ref<string[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const monitorProps = {
children: 'children',
label: 'label'
};
const queryParams = reactive({
monitorId: null,
collectTime: null,
params: {}
});
watch(workUnitName, (val) => {
tree.value?.filter(val);
});
function getList() {
loading.value = true;
queryParams.params = {};
if (daterangeCollectTime.value && daterangeCollectTime.value.length > 0) {
queryParams.params['beginCollectTime'] = daterangeCollectTime.value[0];
queryParams.params['endCollectTime'] = daterangeCollectTime.value[1];
}
getChart();
}
function handleQuery() {
getList();
}
function resetQuery() {
queryParams.monitorId = null;
queryFormRef.value?.resetFields();
handleQuery();
}
function getTreeselect() {
getMonitorInfoTree({ monitorTypeList: [5,6,7,8,9], monitorType: proxy.$route.query.monitorType }).then(response => {
monitorInfoOptions.value = response.data;
});
}
function filterNode(value: string, data: any) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
}
async function handleNodeClick(a: any, datas: any) {
const { data } = await iotInstantMonitoring({ monitorCodeList: datas.checkedKeys.toString() });
list.value = data;
}
function getChart(e?: any) {
// if(!e)return
function Pie() {
let dataArr = [];
for (var i = 0; i < 150; i++) {
if (i % 2 === 0) {
dataArr.push({
name: (i + 1).toString(),
value: 50,
itemStyle: {
normal: {
color: "#00AFFF",
borderWidth: 0,
borderColor: "rgba(0,0,0,0)",
},
},
});
} else {
dataArr.push({
name: (i + 1).toString(),
value: 100,
itemStyle: {
normal: {
color: "rgba(0,0,0,0)",
borderWidth: 0,
borderColor: "rgba(0,0,0,0)",
},
},
});
}
}
return dataArr;
}
let option = {
backgroundColor: "rgba(255, 255, 255)",
// title: {
// text: '',
// textStyle: {
// fontWeight: 'normal',
// fontSize: 25,
// color: 'rgb(97, 142, 205)'
// }
// },
series: [
{
// value: 50, // formatter
type: "liquidFill",
radius: "70%", //
center: ["50%", "50%"],
data: [
0.6,
{
value: 0.6,
direction: "left", //
},
], // data
backgroundStyle: {
borderWidth: 1,
color: "rgba(62, 208, 255, 1)", //
},
amplitude: "6 %", //
//
// color: ['#0286ea', 'l#0b99ff'], //
color: [
{
type: "linear",
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [
{
offset: 1,
color: "#6CDEFC",
},
{
offset: 0,
color: "#429BF7",
},
],
globalCoord: false,
},
],
label: {
normal: {
// formatter: 0.87 * 100 + '\n%',
formatter: 0.6 * 100 + "\n{d|%}",
// formatter: function(params){
// return params.value* 100 + " \n%";
// },
rich: {
d: {
fontSize: 36,
},
},
textStyle: {
fontSize: 48,
color: "#fff",
},
},
},
outline: {
show: false,
},
},
{
type: "pie",
z: 1,
center: ["50%", "50%"],
radius: ["72%", "73.5%"], //
hoverAnimation: false,
data: [
{
name: "",
value: 500,
labelLine: {
show: false,
},
itemStyle: {
color: "#00AFFF",
},
emphasis: {
labelLine: {
show: false,
},
itemStyle: {
color: "#00AFFF",
},
},
},
],
},
{
//
type: "pie",
z: 1,
zlevel: -1,
radius: ["70%", "90.5%"],
center: ["50%", "50%"],
hoverAnimation: false,
clockWise: false,
itemStyle: {
normal: {
borderWidth: 20,
color: "rgba(224,242,255,1)",
},
},
label: {
show: false,
},
data: [100],
},
{
//
type: "pie",
z: 1,
zlevel: -2,
radius: ["70%", "100%"],
center: ["50%", "50%"],
hoverAnimation: false,
clockWise: false,
itemStyle: {
normal: {
borderWidth: 20,
color: "rgba(224,242,255,.4)",
},
},
label: {
show: false,
},
data: [100],
},
{
type: "pie",
zlevel: 0,
silent: true,
radius: ["78%", "80%"],
z: 1,
label: {
normal: {
show: false,
},
},
labelLine: {
normal: {
show: false,
},
},
data: Pie(),
},
],
};
return option;
}
onMounted(() => {
const nowDate = parseTime(new Date(), '{y}-{m}-{d}');
daterangeCollectTime.value[0] = nowDate + ' 00:00:00';
daterangeCollectTime.value[1] = nowDate + ' 23:59:59';
getTreeselect();
getList();
});
</script>
<style scoped>
.chart {
display: inline-block;
width: 50%;
height: 40vh;
position: relative;
}
.chart .title{
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
font-size: 1vw;
font-weight: 700;
}
.chart2 {
width: 100%;
height: 40vh;
}
</style>

@ -1,400 +0,0 @@
<template>
<div class="p-2">
<el-row :gutter="28">
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="workUnitName"
placeholder="请输入物联网设备名称"
clearable
prefix-icon="Search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="monitorInfoOptions"
:props="monitorProps"
ref="tree"
show-checkbox
node-key="code"
:check-strictly="true"
default-expand-all
:expand-on-click-node="false"
highlight-current
@check="handleNodeClick">
</el-tree>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"
label-width="100px"
>
<!-- <el-form-item label="计量设备编号" prop="monitorCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.monitorCode"-->
<!-- placeholder="请输入计量设备编号"-->
<!-- clearable-->
<!-- @keyup.enter="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="采集时间">
<el-date-picker
v-model="daterangeCollectTime"
style="width: 340px"
value-format="YYYY-MM-DD HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- <div v-for="item in list" class="chart">-->
<!-- <Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart(item)"/>-->
<!-- <div class="title">{{item.monitorName}}</div>-->
<!-- </div>-->
<div class="chart">
<Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart()"/>
</div>
</el-col>
</el-row>
</div>
</template>
<script setup lang="ts" name="TemperatureHumidityMonitoring3">
import { ref, reactive, watch, onMounted, getCurrentInstance } from 'vue';
import { getMonitorInfoTree } from '@/api/ems/base/baseMonitorInfo';
import { iotInstantMonitoring } from '@/api/ems/report/TemperatureHumidityMonitoring';
import { parseTime } from '@/utils/ruoyi';
import Chart from '@/components/chart.vue';
import * as echarts from 'echarts';
import type { ElTree } from 'element-plus';
const { proxy } = getCurrentInstance() as any;
const tree = ref<InstanceType<typeof ElTree>>();
const queryFormRef = ref();
const list = ref<any[]>([]);
const monitorInfoOptions = ref<any[]>([]);
const workUnitName = ref<string>();
const daterangeCollectTime = ref<string[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const monitorProps = {
children: 'children',
label: 'label'
};
const queryParams = reactive({
monitorId: null,
collectTime: null,
params: {}
});
watch(workUnitName, (val) => {
tree.value?.filter(val);
});
function getList() {
loading.value = true;
queryParams.params = {};
if (daterangeCollectTime.value && daterangeCollectTime.value.length > 0) {
queryParams.params['beginCollectTime'] = daterangeCollectTime.value[0];
queryParams.params['endCollectTime'] = daterangeCollectTime.value[1];
}
getChart();
}
function handleQuery() {
getList();
}
function resetQuery() {
queryParams.monitorId = null;
queryFormRef.value?.resetFields();
handleQuery();
}
function getTreeselect() {
getMonitorInfoTree({ monitorTypeList: [5,6,7,8,9], monitorType: proxy.$route.query.monitorType }).then(response => {
monitorInfoOptions.value = response.data;
});
}
function filterNode(value: string, data: any) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
}
async function handleNodeClick(a: any, datas: any) {
const { data } = await iotInstantMonitoring({ monitorCodeList: datas.checkedKeys.toString() });
list.value = data;
}
function getChart(e?: any) {
list: [],
//List
baseMonitorInfoOptions: [],
//List
monitorInfoOptions: [],
workUnitName: undefined,
//
selectMonitorName: null,
//
baseMonitorInfoList: [],
//
daterangeCollectTime: [],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
dataList: [],
//
title: '',
//
open: false,
//
queryParams: {
monitorId: null,
collectTime: null,
tempreture: null,
humidity: null,
illuminance: null,
noise: null,
concentration: null,
recordTime: null,
glys: null,
zxyg: null,
activePower: null,
reactivePower: null,
collectType: null
},
//
form: {},
monitorProps: {
children: 'children',
label: 'label'
},
//
rules: {
objId: [
{required: true, message: '编号不能为空', trigger: 'blur'}
]
},
columns: [
{key: 0, label: `主键标识`, visible: false},
{key: 1, label: `计量设备编号`, visible: true},
{key: 2, label: `采集时间`, visible: true},
{key: 3, label: `温度`, visible: true},
{key: 4, label: `湿度`, visible: true},
{key: 5, label: `照度`, visible: true},
{key: 6, label: `噪声`, visible: true},
{key: 7, label: `硫化氢浓度`, visible: true},
{key: 8, label: `记录时间`, visible: true},
{key: 9, label: `报警类型`, visible: true},
{key: 10, label: ``, visible: true},
{key: 11, label: ``, visible: false},
{key: 12, label: ``, visible: false},
{key: 13, label: ``, visible: true},
{key: 14, label: ``, visible: true}
]
}
},
created() {
const nowDate = parseTime(new Date(), '{y}-{m}-{d}')
this.daterangeCollectTime[0] = nowDate + ' 00:00:00'
this.daterangeCollectTime[1] = nowDate + ' 23:59:59'
this.getTreeselect()
this.getList()
},
watch: {
//
workUnitName(val) {
this.$refs.tree.filter(val)
}
},
methods: {
/** 转换计量设备信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.monitorId,
label: node.monitorName,
children: node.children
}
},
/** 查询电实时数据列表 */
getList() {
this.loading = true
this.queryParams.params = {}
if (null != this.daterangeCollectTime && '' != this.daterangeCollectTime) {
this.queryParams.params['beginCollectTime'] = this.daterangeCollectTime[0]
this.queryParams.params['endCollectTime'] = this.daterangeCollectTime[1]
}
console.log(this.monitorInfoOptions)
this.getChart()
},
//
cancel() {
dialogOpen.value = false
this.reset()
},
//
reset() {
this.form = {
objId: null,
monitorId: null,
collectTime: null,
recordTime: null,
collectType: 1
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.monitorId = null
this.resetForm('queryForm')
this.handleQuery()
},
/** 导出按钮操作 */
handleExport() {
this.download('ems/record/recordIOTInstant/export', {
...this.queryParams
}, `recordIOTInstant_${new Date().getTime()}.xlsx`)
},
/** 查询计量设备信息下拉树结构 */
getTreeselect() {
getMonitorInfoTree({
monitorTypeList: [5, 6, 7, 8, 9],
monitorType: this.$route.query.monitorType
}).then(response => {
this.monitorInfoOptions = response.data
})
},
/** 筛选节点 */
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
/** 节点单击事件 */
async handleNodeClick(a, datas) {
// console.log(datas.checkedKeys)
const {data} = await iotInstantMonitoring({monitorCodeList: datas.checkedKeys.toString()})
this.list = data
// console.log(data)
// this.queryParams.monitorTypeList = type
// this.queryParams.monitorId = data.code
// this.selectMonitorName = data.label
// this.handleQuery()
},
/** 物联网设备曲线 */
getChart(e) {
// if(!e)return
let option = {
title: {
text: "Mouse Beautiful",
textStyle: {
fontWeight: "normal",
fontSize: 25,
color: "#fff",
},
},
series: [
{
type: "liquidFill",
data: [0.7, 0.8, 0.75, 0.21, 0.2, 0.13, 0.1],
radius: "80%",
waveLength: "90%",
waveHeight: "10",
amplitude: 10,
outline: {show: false},
waveAnimation: false,
backgroundStyle: {
color: "#333",
borderColor: "#fff",
borderWidth: 1,
shadowColor: "rgba(0, 0, 0, 0.4)",
shadowBlur: 20,
},
//path,
shape: "path://M281.674 253.424c11.553-14.585 24.288-28.14 38.208-40.267l-68.978-69.013c-10.828-10.867-28.404-10.867-39.275 0-10.831 10.831-10.831 28.404 0 39.235l70.046 70.043zM506.013 142.469c0.268 0 0.494 0 0.802 0 9.109 0 18.109 0.571 26.955 1.487l0-93.986c0-15.327-12.432-27.757-27.76-27.757s-27.721 12.429-27.721 27.757l0 93.968c8.846-0.895 17.842-1.469 26.956-1.469 0.27 0 0.534 0 0.762 0zM730.414 253.388l69.971-70.007c10.866-10.831 10.866-28.404 0-39.235-10.794-10.867-28.405-10.867-39.277 0l-69.018 69.013c13.958 12.123 26.695 25.664 38.324 40.227zM213.494 450.225c0-13.403 1.07-26.519 2.633-39.483l-98.682 0c-15.289 0-27.722 12.432-27.722 27.757 0 15.328 12.434 27.757 27.722 27.757l96.393 0c-0.229-5.28-0.345-10.581-0.345-16.033zM894.563 410.745l-98.643 0c1.6 12.964 2.633 26.082 2.633 39.483 0 5.45-0.115 10.753-0.305 16.033l96.315 0c15.332 0 27.722-12.429 27.722-27.757s-12.39-27.757-27.722-27.757zM745.017 638.262c-11.286 16.547-23.218 30.843-34.695 43.77l50.787 50.829c10.868 10.831 28.483 10.831 39.277 0 10.866-10.867 10.866-28.404 0-39.275l-55.37-55.324zM211.627 693.585c-10.831 10.867-10.831 28.404 0 39.275 10.868 10.831 28.448 10.831 39.275 0l50.83-50.863c-11.475-12.889-23.412-27.222-34.699-43.731l-55.403 55.324zM760.039 450.225c0.037-57.556-19.138-110.785-51.438-153.414-28.33-37.442-66.806-66.802-111.379-84.036l0.229-1.222-19.026-5.586c-14.798-4.29-30.051-7.265-45.605-8.867l-2.211-0.246-0.075 0-0.079-0.019c-7.623-0.724-15.557-1.279-23.83-1.279l-1.218 0c-8.276 0-16.207 0.557-23.833 1.279l-0.115 0.019-2.286 0.246c-15.535 1.6-30.791 4.575-45.549 8.867l-18.416 5.374 0.19 1.222c-44.802 17.214-83.505 46.651-111.99 84.244-32.258 42.628-51.438 95.854-51.438 153.414 0 41.274 7.132 75.207 18.227 103.29 16.661 42.114 42.094 70.559 62.533 92.138 10.22 10.754 19.22 19.941 25.317 27.795 6.254 7.892 9.265 13.995 10.141 18.837 4.459 23.565 4.917 53.306 4.917 60.854l0 2.174c0 34.085 27.609 61.617 61.659 61.655l142.51 0c34.092-0.037 61.659-27.609 61.659-61.655l0-2.097c-0.037-7.474 0.458-37.291 4.919-60.893 0.608-3.278 2.058-7.017 4.917-11.591 4.88-7.97 14.11-17.883 25.548-29.819 17.083-17.959 38.815-40.604 56.091-72.805 17.312-32.161 29.703-73.706 29.626-127.882zM701.813 537.676c-13.614 34.336-34.053 57.575-53.763 78.391-9.841 10.411-19.487 20.095-27.911 30.812-8.311 10.562-15.745 22.65-18.606 37.481-5.377 28.94-5.607 59.978-5.638 68.862 0 1.181 0 1.828 0 2.096-0.037 10.295-8.314 18.606-18.608 18.606l-142.51 0c-5.223 0-9.761-2.059-13.194-5.45-3.391-3.434-5.412-7.934-5.412-13.154 0-0.268 0-0.953 0-2.172-0.037-8.957-0.306-39.921-5.682-68.783-1.828-9.797-5.834-18.571-10.674-26.348-8.579-13.612-19.559-24.819-30.889-36.832-17.116-17.842-35.232-37.119-49.341-63.41-14.07-26.309-24.517-59.745-24.557-107.54 0.037-47.947 15.862-91.95 42.706-127.427 26.845-35.442 64.595-62.209 108.175-75.246l5.377-1.638c10.524-2.708 21.315-4.861 32.429-6.026l0.075 0 2.06-0.229c6.519-0.627 12.847-1.03 19.103-1.066l1.105 0.115 1.106-0.076c6.212 0 12.579 0.42 19.063 1.03l-0.079 0 2.137 0.229 0.037 0c11.093 1.163 21.887 3.277 32.372 6.026l5.451 1.638c43.582 13.037 81.329 39.807 108.175 75.246 26.801 35.478 42.666 79.482 42.666 127.427 0.003 36.409-6.094 64.511-15.169 87.446zM532.782 197.107l0.079 0zM479.17 197.107l0 0c0 0 0.037 0 0.075 0l-0.075 0zM576.706 833.825l-141.369 0c-14.604 0-26.499 11.822-26.499 26.539 0 14.564 11.899 26.465 26.499 26.465l141.369 0c14.604 0 26.499-11.899 26.499-26.465 0-14.721-11.899-26.539-26.499-26.539zM576.706 900.704l-141.369 0c-14.604 0-26.499 11.857-26.499 26.464 0 14.678 11.899 26.539 26.499 26.539l141.369 0c14.604 0 26.499-11.857 26.499-26.539 0-14.605-11.899-26.464-26.499-26.464zM518.406 968.116l-72.805 0c0 0.801-0.154 1.561-0.154 2.404 0 14.643 22.498 26.499 43.297 26.499l34.546 0c20.818 0 43.277-11.857 43.277-26.499 0-0.837-0.115-1.6-0.115-2.404l-48.044 0z",
color: ["#f6ad40"],
label: {
normal: {
formatter: '20',
textStyle: {
fontSize: 26,
color: "#000",
},
},
},
},
],
};
return option;
}
onMounted(() => {
const nowDate = parseTime(new Date(), '{y}-{m}-{d}');
daterangeCollectTime.value[0] = nowDate + ' 00:00:00';
daterangeCollectTime.value[1] = nowDate + ' 23:59:59';
getTreeselect();
getList();
});
</script>
<style scoped>
.chart {
display: inline-block;
width: 50%;
height: 40vh;
position: relative;
}
.chart .title {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
font-size: 1vw;
font-weight: 700;
}
.chart2 {
width: 100%;
height: 40vh;
}
</style>

@ -1,257 +0,0 @@
<template>
<div class="p-2">
<el-row :gutter="28">
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="workUnitName"
placeholder="请输入物联网设备名称"
clearable
prefix-icon="Search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="monitorInfoOptions"
:props="monitorProps"
ref="tree"
show-checkbox
node-key="code"
:check-strictly="true"
default-expand-all
:expand-on-click-node="false"
highlight-current
@check="handleNodeClick">
</el-tree>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"
label-width="100px"
>
<!-- <el-form-item label="计量设备编号" prop="monitorCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.monitorCode"-->
<!-- placeholder="请输入计量设备编号"-->
<!-- clearable-->
<!-- @keyup.enter="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="采集时间">
<el-date-picker
v-model="daterangeCollectTime"
style="width: 340px"
value-format="yyyy-MM-dd HH:mm:ss"
type="datetimerange"
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery"></el-button>
<el-button icon="Refresh" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- <div v-for="item in list" class="chart">-->
<!-- <Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart(item)"/>-->
<!-- <div class="title">{{item.monitorName}}</div>-->
<!-- </div>-->
<div class="chart">
<Chart ref="Chart1" style="width: 100%;height: 100%" :chartOption="getChart()"/>
</div>
</el-col>
</el-row>
</div>
</template>
<script setup lang="ts" name="TemperatureHumidityMonitoring4">
import { ref, reactive, watch, onMounted, getCurrentInstance } from 'vue';
import { listRecordIOTInstant } from '@/api/ems/record/recordIOTInstant';
import { getMonitorInfoTree } from '@/api/ems/base/baseMonitorInfo';
import { parseTime } from '@/utils/ruoyi';
import { useDict } from '@/utils/dict';
import { useRoute } from 'vue-router';
import type { ElTree } from 'element-plus';
const { proxy } = getCurrentInstance() as any;
const route = useRoute();
const { collect_type } = useDict('collect_type');
//
const tree = ref<InstanceType<typeof ElTree>>();
const queryFormRef = ref();
//
const list = ref<any[]>([]);
const monitorInfoOptions = ref<any[]>([]);
const workUnitName = ref<string>();
const selectMonitorName = ref<string | null>(null);
const baseMonitorInfoList = ref<any[]>([]);
const daterangeCollectTime = ref<string[]>([]);
const loading = ref(true);
const showSearch = ref(true);
const total = ref(0);
const dataList = ref<any[]>([]);
const queryParams = reactive({
monitorId: null as string | null,
collectTime: null as string | null,
tempreture: null as number | null,
humidity: null as number | null,
illuminance: null as number | null,
noise: null as number | null,
concentration: null as number | null,
recordTime: null as string | null,
glys: null as number | null,
zxyg: null as number | null,
activePower: null as number | null,
reactivePower: null as number | null,
collectType: null as number | null,
params: {} as any
});
const form = reactive({
objId: null as string | number | null,
monitorId: null as string | number | null,
collectTime: null as string | null,
recordTime: null as string | null,
collectType: 1
});
const monitorProps = {
children: 'children',
label: 'label'
};
//
watch(workUnitName, (val) => {
tree.value?.filter(val);
});
/** 转换计量设备信息数据结构 */
function normalizer(node: any) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.monitorId,
label: node.monitorName,
children: node.children
};
}
/** 查询电实时数据列表 */
function getList() {
loading.value = true;
queryParams.params = {};
if (daterangeCollectTime.value && daterangeCollectTime.value.length > 0) {
queryParams.params['beginCollectTime'] = daterangeCollectTime.value[0];
queryParams.params['endCollectTime'] = daterangeCollectTime.value[1];
}
getChart();
}
/** 搜索按钮操作 */
function handleQuery() {
getList();
}
/** 重置按钮操作 */
function resetQuery() {
queryParams.monitorId = null;
proxy.resetForm('queryFormRef');
handleQuery();
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('ems/record/recordIOTInstant/export', {
...queryParams
}, `recordIOTInstant_${new Date().getTime()}.xlsx`);
}
/** 查询计量设备信息下拉树结构 */
function getTreeselect() {
getMonitorInfoTree({
monitorTypeList: [5, 6, 7, 8, 9],
monitorType: route.query.monitorType as string
}).then(response => {
monitorInfoOptions.value = response.data;
});
}
/** 筛选节点 */
function filterNode(value: string, data: any) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
}
/** 节点单击事件 */
async function handleNodeClick(a: any, datas: any) {
// TODO:
console.log('Checked keys:', datas.checkedKeys);
// const { data } = await iotInstantMonitoring({
// monitorCodeList: datas.checkedKeys.toString()
// });
// list.value = data;
}
/** 物联网设备曲线 */
function getChart(e?: any) {
const option = {
series: [
{
name: 'Pressure',
type: 'gauge',
detail: {
formatter: '{value}'
},
center: ['25%', '50%'],
radius: '90%',
data: [
{
value: 12,
name: '温度',
title: {}
}
]
}
]
};
return option;
}
onMounted(() => {
const nowDate = parseTime(new Date(), '{y}-{m}-{d}');
daterangeCollectTime.value[0] = nowDate + ' 00:00:00';
daterangeCollectTime.value[1] = nowDate + ' 23:59:59';
getTreeselect();
getList();
});
</script>
<style scoped>
.chart {
display: inline-block;
width: 50%;
height: 40vh;
position: relative;
}
.chart .title{
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
font-size: 1vw;
font-weight: 700;
}
.chart2 {
width: 100%;
height: 40vh;
}
</style>

@ -1,674 +0,0 @@
<template>
<div class="app-container">
<el-row :gutter="28">
<el-col :span="4.3" :xs="24">
<div class="head-container">
<el-input
v-model="workUnitName"
placeholder="请输入计量设备名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="monitorInfoOptions"
:props="monitorProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="100px"
>
<!-- <el-form-item label="计量设备编号" prop="monitorCode">-->
<!-- <el-input-->
<!-- v-model="queryParams.monitorCode"-->
<!-- placeholder="请输入计量设备编号"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="采集时间">
<date-picker
v-model="daterangeRecordTime"
range
type="datetime"
format="YYYY-MM-DD HH:mm:ss"
value-type="YYYY-MM-DD HH:mm:ss"
:placeholder="['开始时间', '结束时间']"
:lang="lang"
style="width: 340px"
></date-picker>
</el-form-item>
<!-- <el-form-item label="采集日期范围">
<el-date-picker
v-model="daterangeCollectTime"
style="width: 340px"
value-format="yyyy-MM-dd"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>-->
<!-- <el-form-item label="记录时间范围">
<el-time-picker
v-model="timerangeRecordTime"
style="width: 340px"
value-format="HH:mm:ss"
is-range
range-separator="-"
start-placeholder="开始时间"
end-placeholder="结束时间"
></el-time-picker>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<Chart ref="Chart1" class="chart1"/>
<Chart ref="Chart2" class="chart2"/>
<Chart ref="Chart3" class="chart3"/>
</el-col>
</el-row>
</div>
</template>
<script>
import { getMonitorInfoTree } from '@/api/ems/base/baseMonitorInfo'
import Treeselect from 'vue3-treeselect'
import { parseTime } from '@/utils/ruoyi'
import Chart from '@/components/Charts/Chart'
import * as echarts from 'echarts'
import {pointSteamInstantList} from "@/api/ems/report/reportPointSteam";
import {listRecordSteamInstant, steamInstantAvg, steamInstantList} from "@/api/ems/record/recordSteamInstant";
import DatePicker from 'vue-datepicker-next';
import 'vue-datepicker-next/index.css';
export default {
name: 'currentSteamCurve',
dicts: ['collect_type'],
components: {
Chart,
Treeselect,
DatePicker
},
data() {
return {
//List
baseMonitorInfoOptions: [],
//List
monitorInfoOptions: [],
workUnitName: undefined,
//
selectMonitorName: null,
//
baseMonitorInfoList: [],
//
daterangeCollectTime: [],
//
daterangeRecordTime: [],
//
timerangeRecordTime:[],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
dataList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
monitorCode: null,
monitorName: null,
collectTime: null,
fluxFlow: null,
steamFlow: null,
heatInstantValue: null,
heatTotalValue: null,
temperature: null,
press: null,
density: null,
differencePress: null,
recordTime: null
},
//
form: {},
monitorProps: {
children: 'children',
label: 'label'
},
//
rules: {
/* objId: [
{ required: true, message: '编号不能为空', trigger: 'blur' }
]*/
},
columns: [
{ key: 0, label: `自增标识`, visible: false },
{ key: 1, label: `计量设备编号`, visible: true },
{ key: 2, label: `采集时间`, visible: false },
{ key: 3, label: `瞬时流量`, visible: true },
{ key: 4, label: `累计流量`, visible: true },
{ key: 5, label: `瞬时热量`, visible: true },
{ key: 6, label: `累计热量`, visible: true },
{ key: 7, label: `温度`, visible: false },
{ key: 8, label: `压力`, visible: false },
{ key: 9, label: `密度`, visible: false },
{ key: 10, label: `压力差值`, visible: false },
{ key: 11, label: `记录时间`, visible: true },
{ key: 12, label: `计量设备名称`, visible: true }
],
lang: {
formatLocale: {
firstDayOfWeek: 1
},
monthBeforeYear: false
}
}
},
created() {
const nowDate = new Date();
const today = parseTime(new Date(), '{y}-{m}-{d}')
const lastDate = new Date();
lastDate.setDate(nowDate.getDate() - 1)
const yesterday = parseTime(lastDate, '{y}-{m}-{d}')
console.log(today,yesterday)
this.daterangeRecordTime[0] = yesterday+ ' 08:00:00'
this.daterangeRecordTime[1] = today + ' 08:00:00'
/* this.daterangeCollectTime[0] = parseTime(yesterday, '{y}-{m}-{d}') ;
this.daterangeCollectTime[1] = parseTime(today, '{y}-{m}-{d}') ;
//8
this.timerangeRecordTime[0] = '08:00:00';
this.timerangeRecordTime[1] = '08:00:00';*/
this.getTreeselect()
this.getTreeMonitorInfo()
this.getList()
},
watch: {
//
workUnitName(val) {
this.$refs.tree.filter(val)
}
},
methods: {
/** 转换计量设备信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.monitorCode,
label: node.monitorName,
children: node.children
}
},
/** 查询电实时数据列表 */
getList() {
this.loading = true
this.queryParams.params = {}
/* if (null != this.daterangeCollectTime && '' != this.daterangeCollectTime) {
this.queryParams.params['beginCollectTime'] =this.daterangeCollectTime[0] + ' ' + this.timerangeRecordTime[0];
this.queryParams.params['endCollectTime'] =this.daterangeCollectTime[1] + ' ' + this.timerangeRecordTime[1];
}*/
if (null != this.daterangeRecordTime && '' != this.daterangeRecordTime) {
this.queryParams.params['beginRecordTime'] =this.daterangeRecordTime[0];
this.queryParams.params['endRecordTime'] =this.daterangeRecordTime[1];
}
this.getChart()
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
objId: null,
monitorCode: null,
instrumentValue: null,
expend: null,
recordTime: null,
beginTime: null,
endTime: null,
updateFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.monitorCode = null
this.resetForm('queryForm')
this.handleQuery()
},
/** 导出按钮操作 */
handleExport() {
this.download('ems/record/recordSteamInstant/export', {
...this.queryParams
}, `recordSteamInstant_${new Date().getTime()}.xlsx`)
},
/** 查询计量设备信息下拉树结构 */
getTreeselect() {
getMonitorInfoTree({ monitorType: 4 }).then(response => {
this.monitorInfoOptions = response.data
})
},
/** 筛选节点 */
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
/** 节点单击事件 */
handleNodeClick(data) {
this.queryParams.monitorCode = data.code
this.selectMonitorName = data.label
this.handleQuery()
},
/** 曲线 */
async getChart() {
let query = JSON.parse(JSON.stringify(this.queryParams))
const {data} = await steamInstantList(query)
let option1 = {
title: {
text: this.selectMonitorName + ' 瞬时流量' + ' (平均值:'+
((data.map(e=>parseFloat(e.fluxFlow)).reduce((a,b)=>a+b,0))/data.length).toFixed(2)+")",
x: 'center',
textStyle: {
fontSize: 15 //
}
},
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
dataZoom: [{
type: 'slider'
}],
legend: {
right: 0
},
xAxis: {
data: data.map(e => e.recordTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true //X
},
axisLabel: {
show: true,
textStyle: {
color: '#000000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '瞬时流量y',
nameTextStyle: {
color: '#000000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
],
series: [
{
name: '瞬时流量',
type: 'line',
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 0, //
data: data.map(e => e.fluxFlow)
},
]
}
let option2 = {
/* 使 filter temperature undefined null
title: {
text: this.selectMonitorName + ' 温度' + ' (平均值:' +
((data.filter(e => e.temperature !== undefined && e.temperature !== null)
.map(e => parseFloat(e.temperature))
.reduce((a, b) => a + b, 0)) /
data.filter(e => e.temperature !== undefined && e.temperature !== null).length).toFixed(2) + ")",
x: 'center'
},*/
title: {
text: this.selectMonitorName + ' 温度' + ' (平均值:'+
((data.map(e=>parseFloat(e.temperature)).reduce((a,b)=>a+b,0))/data.length).toFixed(2)+")",
x: 'center',
textStyle: {
fontSize: 15 //
}
},
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
dataZoom: [{
type: 'slider'
}],
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
legend: {
right: 0
},
xAxis: {
data: data.map(e => e.recordTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true //X
},
axisLabel: {
show: true,
textStyle: {
color: '#000000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '温度y',
nameTextStyle: {
color: '#000000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
],
series: [
{
name: '温度',
type: 'line',
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 0, //
data: data.map(e => e.temperature)
},
]
}
let option3 = {
title: {
text: this.selectMonitorName + ' 压力' + ' (平均值:'+
((data.map(e=>parseFloat(e.press)).reduce((a,b)=>a+b,0))/data.length).toFixed(2)+")",
x: 'center',
textStyle: {
fontSize: 15 //
}
},
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
dataZoom: [{
type: 'slider'
}],
legend: {
right: 0
},
xAxis: {
data: data.map(e => e.recordTime),
axisLine: {
show: true, //X线
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true //X
},
axisLabel: {
show: true,
textStyle: {
color: '#000000' //X
}
}
},
yAxis: [
{
type: 'value',
name: '压力y',
nameTextStyle: {
color: '#000000'
},
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
],
series: [
{
name: '压力',
type: 'line',
smooth: true, //线
showAllSymbol: true, //
symbol: 'circle', //
symbolSize: 0, //
data: data.map(e => e.press)
},
]
}
this.$refs.Chart1.setData(option1)
this.$refs.Chart2.setData(option2)
this.$refs.Chart3.setData(option3)
echarts.connect(this.$refs.Chart1.chart, this.$refs.Chart2.chart, this.$refs.Chart3.chart)
/* this.$refs.Chart1.chart.on('datazoom', (e) => {
option.dataZoom[0].start = e.start;
option.dataZoom[0].end = e.end;
this.$refs.Chart1.setData(option);
});*/
this.$refs.Chart1.chart.on('datazoom', (e) => {
option2.dataZoom[0].start = e.start
option2.dataZoom[0].end = e.end
this.$refs.Chart2.setData(option2)
option3.dataZoom[0].start = e.start
option3.dataZoom[0].end = e.end
this.$refs.Chart3.setData(option3)
})
this.$refs.Chart2.chart.on('datazoom', (e) => {
option1.dataZoom[0].start = e.start
option1.dataZoom[0].end = e.end
this.$refs.Chart1.setData(option1)
option3.dataZoom[0].start = e.start
option3.dataZoom[0].end = e.end
this.$refs.Chart3.setData(option3)
})
this.$refs.Chart3.chart.on('datazoom', (e) => {
option2.dataZoom[0].start = e.start
option2.dataZoom[0].end = e.end
this.$refs.Chart2.setData(option2)
option1.dataZoom[0].start = e.start
option1.dataZoom[0].end = e.end
this.$refs.Chart1.setData(option1)
})
}
}
}
</script>
<style scoped >
.chart1 {
width: 50%;
height: 40vh;
display: inline-block;
}
.chart2 {
width: 50%;
height: 40vh;
display: inline-block;
}
.chart3 {
width: 50%;
height: 40vh;
display: inline-block;
}
/* 选中节点的样式 */
/deep/ .el-tree .el-tree-node.is-current > .el-tree-node__content {
background-color: #67C23A !important; /* 选中节点的背景色 */
color: #303133 !important; /* 选中节点的文字颜色 */
padding: 0; /* 清除内边距 */
margin: 0; /* 清除外边距 */
z-index: 1; /* 确保在其他元素之上 */
}
/* 鼠标悬停时的样式 */
.el-tree .el-tree-node__content:hover {
background-color: #e6f7ff; /* 鼠标悬停时的背景色 */
}
</style>

@ -1,841 +0,0 @@
<template>
<div class="app-container">
<el-row :gutter="28">
<el-col :span="4.3" :xs="24">
<div class="head-container">
<el-input
v-model="workUnitName"
placeholder="请输入计量设备名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<el-tree
:data="monitorInfoOptions"
:props="monitorProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
label-width="100px"
>
<el-form-item label="记录时间">
<date-picker
v-model="daterangeRecordTime"
range
type="datetime"
format="YYYY-MM-DD HH:mm:ss"
value-type="YYYY-MM-DD HH:mm:ss"
:placeholder="['开始时间', '结束时间']"
:lang="lang"
style="width: 340px"
></date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<!-- 图表联动提示 -->
<el-alert
v-if="powerOutageSummary.count > 0"
title="图表已联动,缩放任一图表将同步其它图表"
type="info"
:closable="false"
show-icon
style="margin-bottom: 10px"
/>
<!-- 停电统计信息 -->
<el-card v-if="powerOutageSummary.count > 0" class="power-outage-summary" shadow="hover">
<div slot="header">
<span><i class="el-icon-lightning" style="color: red;"></i> 停电统计</span>
<el-button style="float: right; padding: 3px 0" type="text" @click="exportPowerOutageData">
导出停电记录
</el-button>
</div>
<div class="power-outage-info">
<p><strong>停电次数:</strong> {{ powerOutageSummary.count }} </p>
<p><strong>最长停电:</strong> {{ powerOutageSummary.longestDuration }} 小时</p>
<p><strong>总停电时长:</strong> {{ powerOutageSummary.totalDuration }} 小时</p>
</div>
</el-card>
<!-- 图表区域 -->
<div class="charts-container">
<Chart ref="Chart1" class="chart1"/>
<Chart ref="Chart2" class="chart2"/>
<Chart ref="Chart3" class="chart3"/>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import { getMonitorInfoTree } from '@/api/ems/base/baseMonitorInfo'
import Treeselect from 'vue3-treeselect'
import { parseTime } from '@/utils/ruoyi'
import Chart from '@/components/Charts/Chart'
import * as echarts from 'echarts'
import {pointSteamInstantList} from "@/api/ems/report/reportPointSteam";
import {listRecordSteamInstant, steamInstantAvg, steamInstantList} from "@/api/ems/record/recordSteamInstant";
import DatePicker from 'vue-datepicker-next';
import 'vue-datepicker-next/index.css';
export default {
name: 'currentSteamCurve',
dicts: ['collect_type'],
components: {
Chart,
Treeselect,
DatePicker
},
data() {
return {
//List
baseMonitorInfoOptions: [],
//List
monitorInfoOptions: [],
workUnitName: undefined,
//
selectMonitorName: null,
//
baseMonitorInfoList: [],
//
daterangeCollectTime: [],
//
daterangeRecordTime: [],
//
timerangeRecordTime:[],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
dataList: [],
//
title: '',
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
monitorCode: null,
monitorName: null,
collectTime: null,
fluxFlow: null,
steamFlow: null,
heatInstantValue: null,
heatTotalValue: null,
temperature: null,
press: null,
density: null,
differencePress: null,
recordTime: null
},
//
form: {},
monitorProps: {
children: 'children',
label: 'label'
},
//
rules: {
/* objId: [
{ required: true, message: '编号不能为空', trigger: 'blur' }
]*/
},
columns: [
{ key: 0, label: `自增标识`, visible: false },
{ key: 1, label: `计量设备编号`, visible: true },
{ key: 2, label: `采集时间`, visible: false },
{ key: 3, label: `瞬时流量`, visible: true },
{ key: 4, label: `累计流量`, visible: true },
{ key: 5, label: `瞬时热量`, visible: true },
{ key: 6, label: `累计热量`, visible: true },
{ key: 7, label: `温度`, visible: false },
{ key: 8, label: `压力`, visible: false },
{ key: 9, label: `密度`, visible: false },
{ key: 10, label: `压力差值`, visible: false },
{ key: 11, label: `记录时间`, visible: true },
{ key: 12, label: `计量设备名称`, visible: true }
],
lang: {
formatLocale: {
firstDayOfWeek: 1
},
monthBeforeYear: false
},
//
powerOutageSummary: {
count: 0,
totalDuration: 0,
longestDuration: 0
},
//
powerOutageList: [],
//
samplingThreshold: 1000,
//
baseChartOptions: {}
}
},
created() {
const nowDate = new Date();
const today = parseTime(new Date(), '{y}-{m}-{d}')
const lastDate = new Date();
lastDate.setDate(nowDate.getDate() - 1)
const yesterday = parseTime(lastDate, '{y}-{m}-{d}')
console.log(today,yesterday)
this.daterangeRecordTime[0] = yesterday+ ' 08:00:00'
this.daterangeRecordTime[1] = today + ' 08:00:00'
//
this.initBaseChartOptions()
this.getTreeselect()
this.getTreeMonitorInfo()
this.getList()
},
watch: {
//
workUnitName(val) {
this.$refs.tree.filter(val)
}
},
methods: {
/** 初始化图表基础配置 */
initBaseChartOptions() {
this.baseChartOptions = {
grid: {
top: '15%',
bottom: '10%',
left: '10%',
right: '3%'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow',
label: {
show: true
}
}
},
dataZoom: [{
type: 'slider'
}],
legend: {
right: 0,
data: ['数据', '停电']
},
xAxis: {
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisTick: {
show: true
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
},
yAxis: {
type: 'value',
splitLine: {
show: false
},
axisTick: {
show: true
},
axisLine: {
show: true,
lineStyle: {
color: '#000000'
}
},
axisLabel: {
show: true,
textStyle: {
color: '#000000'
}
}
}
}
},
/** 转换计量设备信息数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
}
return {
id: node.monitorCode,
label: node.monitorName,
children: node.children
}
},
/** 查询电实时数据列表 */
getList() {
this.loading = true
this.queryParams.params = {}
if (null != this.daterangeRecordTime && '' != this.daterangeRecordTime) {
this.queryParams.params['beginRecordTime'] = this.daterangeRecordTime[0];
this.queryParams.params['endRecordTime'] = this.daterangeRecordTime[1];
}
this.getChart()
},
//
cancel() {
this.open = false
this.reset()
},
//
reset() {
this.form = {
objId: null,
monitorCode: null,
instrumentValue: null,
expend: null,
recordTime: null,
beginTime: null,
endTime: null,
updateFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
}
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams.monitorCode = null
this.resetForm('queryForm')
this.handleQuery()
},
/** 导出按钮操作 */
handleExport() {
this.download('ems/record/recordSteamInstant/export', {
...this.queryParams
}, `recordSteamInstant_${new Date().getTime()}.xlsx`)
},
/** 导出停电数据 */
exportPowerOutageData() {
if (this.powerOutageList.length === 0) {
this.$message.warning('没有停电数据可导出');
return;
}
//
const columns = [
{label: '序号', prop: 'index'},
{label: '开始时间', prop: 'startTime'},
{label: '结束时间', prop: 'endTime'},
{label: '持续时间(小时)', prop: 'duration'}
];
let table = '<table border="1" cellspacing="0" cellpadding="5">';
//
table += '<tr>';
columns.forEach(col => {
table += `<th>${col.label}</th>`;
});
table += '</tr>';
//
this.powerOutageList.forEach(item => {
table += '<tr>';
columns.forEach(col => {
table += `<td>${item[col.prop]}</td>`;
});
table += '</tr>';
});
table += '</table>';
// HTML
const deviceName = this.selectMonitorName || '设备';
const fileName = `${deviceName}停电记录_${new Date().getTime()}.xls`;
const blob = new Blob([table], {type: 'application/vnd.ms-excel'});
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = fileName;
link.click();
URL.revokeObjectURL(link.href);
},
/** 查询计量设备信息下拉树结构 */
getTreeselect() {
getMonitorInfoTree({ monitorType: 4 }).then(response => {
this.monitorInfoOptions = response.data
})
},
/** 筛选节点 */
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
/** 节点单击事件 */
handleNodeClick(data) {
this.queryParams.monitorCode = data.code
this.selectMonitorName = data.label
this.handleQuery()
},
/**
* 数据抽样处理当数据量大时进行抽样
* @param {Array} dataArray 原始数据数组
* @returns {Array} 抽样后的数据
*/
sampleData(dataArray) {
if (!dataArray || dataArray.length <= this.samplingThreshold) {
return dataArray;
}
//
const interval = Math.ceil(dataArray.length / this.samplingThreshold);
const sampledData = [];
//
for (let i = 0; i < dataArray.length; i += interval) {
sampledData.push(dataArray[i]);
}
//
if (sampledData[sampledData.length - 1] !== dataArray[dataArray.length - 1]) {
sampledData.push(dataArray[dataArray.length - 1]);
}
return sampledData;
},
/**
* 处理时间间隔大于1小时的数据插入标红的0值点
* @param {Array} originalData 原始数据数组
* @param {string} valueField 数值字段名
* @returns {Object} 处理后的数据和标记点
*/
processDataBreaks(originalData, valueField) {
//
const sampledData = this.sampleData(originalData);
if (!sampledData || sampledData.length < 2) {
return {
processedData: sampledData || [],
timeData: sampledData ? sampledData.map(e => e.recordTime) : [],
valueData: sampledData ? sampledData.map(e => e[valueField]) : [],
markPoints: [],
markAreas: []
}
}
//
const sortedData = [...sampledData].sort((a, b) => {
return new Date(a.recordTime) - new Date(b.recordTime)
})
const processedData = []
const markPoints = []
const markAreas = []
const powerOutages = []
const oneHourMs = 60 * 60 * 1000 // 1
//
for (let i = 0; i < sortedData.length; i++) {
processedData.push(sortedData[i])
//
if (i < sortedData.length - 1) {
const currentTime = new Date(sortedData[i].recordTime).getTime()
const nextTime = new Date(sortedData[i + 1].recordTime).getTime()
const timeDiff = nextTime - currentTime
// 1
if (timeDiff > oneHourMs) {
// 1
const breakTime = new Date(currentTime + 60000)
const breakTimeStr = parseTime(breakTime, '{y}-{m}-{d} {h}:{i}:{s}')
const endBreakTime = new Date(nextTime - 60000)
const endBreakTimeStr = parseTime(endBreakTime, '{y}-{m}-{d} {h}:{i}:{s}')
//
const breakPoint = { ...sortedData[i] }
breakPoint.recordTime = breakTimeStr
breakPoint[valueField] = 0
breakPoint.isBreakPoint = true //
processedData.push(breakPoint)
//
markPoints.push({
value: '停电',
xAxis: breakTimeStr,
yAxis: 0,
symbol: 'path://M11.184 6.6C10.744 5.04 9.252 4 7.5 4s-3.244 1.04-3.684 2.6l-3.755 9.96A.5.5 0 0 0 .5 17h3.882a.5.5 0 0 0 .474-.65l-.333-1h6.954l-.333 1A.5.5 0 0 0 11.618 17H15.5a.5.5 0 0 0 .46-.69l-3.776-9.71zm1.372 8.15l-1.087-2.792A.5.5 0 0 0 11 11.5H4a.5.5 0 0 0-.47.342l-1.087 2.917h-1.3l3.446-9.13C5.819 4.673 6.64 4 7.5 4s1.68.673 1.908 1.63l3.446 9.13h-1.298z',
symbolSize: 30,
symbolOffset: [0, '-50%'],
itemStyle: {
color: 'red'
}
})
//
markAreas.push([
{
xAxis: breakTimeStr,
itemStyle: { color: 'rgba(255, 0, 0, 0.1)' }
},
{
xAxis: endBreakTimeStr,
}
])
//
const durationHours = (timeDiff / (1000 * 60 * 60)).toFixed(2);
powerOutages.push({
startTime: parseTime(new Date(currentTime), '{y}-{m}-{d} {h}:{i}:{s}'),
endTime: parseTime(new Date(nextTime), '{y}-{m}-{d} {h}:{i}:{s}'),
duration: durationHours
});
}
}
}
//
this.updatePowerOutageSummary(powerOutages);
//
const timeData = processedData.map(e => e.recordTime)
const valueData = processedData.map(e => e[valueField])
//
const validData = processedData.filter(item => !item.isBreakPoint)
const validValues = validData.map(e => parseFloat(e[valueField]))
const average = validValues.length > 0 ?
(validValues.reduce((a, b) => a + b, 0) / validValues.length).toFixed(2) : 0
return {
processedData,
timeData,
valueData,
markPoints,
markAreas,
average
}
},
/**
* 更新停电统计信息
* @param {Array} powerOutages 停电记录数组
*/
updatePowerOutageSummary(powerOutages) {
if (!powerOutages || powerOutages.length === 0) {
this.powerOutageSummary = {
count: 0,
totalDuration: 0,
longestDuration: 0
};
this.powerOutageList = [];
return;
}
//
let totalDuration = 0;
let longestDuration = 0;
powerOutages.forEach((outage, index) => {
const duration = parseFloat(outage.duration);
totalDuration += duration;
longestDuration = Math.max(longestDuration, duration);
});
//
this.powerOutageSummary = {
count: powerOutages.length,
totalDuration: totalDuration.toFixed(2),
longestDuration: longestDuration.toFixed(2)
};
//
this.powerOutageList = powerOutages.map((outage, index) => ({
index: index + 1,
startTime: outage.startTime,
endTime: outage.endTime,
duration: outage.duration
}));
},
/**
* 创建图表配置
* @param {String} title 图表标题
* @param {Object} dataResult 处理后的数据结果
* @param {String} name 数据名称
* @param {String} yAxisName Y轴名称
* @param {String} color 图表颜色
* @param {Function} tooltipFormatter 提示格式化函数
* @returns {Object} 图表配置
*/
createChartOption(title, dataResult, name, yAxisName, color, tooltipFormatter) {
const option = JSON.parse(JSON.stringify(this.baseChartOptions));
//
option.title = {
text: this.selectMonitorName + ' ' + title + ' (平均值:' + dataResult.average + ")",
x: 'center',
textStyle: {
fontSize: 15
}
};
// X
option.xAxis.data = dataResult.timeData;
// Y
option.yAxis.name = yAxisName;
option.yAxis.nameTextStyle = {
color: '#000000'
};
//
option.tooltip.formatter = tooltipFormatter || function(params) {
const dataIndex = params[0].dataIndex;
const isBreakPoint = dataResult.processedData[dataIndex] && dataResult.processedData[dataIndex].isBreakPoint;
if (isBreakPoint) {
return '停电<br/>时间: ' + params[0].axisValue;
}
return params[0].seriesName + ': ' + params[0].value + '<br/>时间: ' + params[0].axisValue;
};
//
option.series = [{
name: name,
type: 'line',
smooth: true,
showAllSymbol: true,
symbol: 'circle',
symbolSize: 4,
itemStyle: {
normal: {
color: function(params) {
return dataResult.processedData[params.dataIndex].isBreakPoint ? 'red' : color;
}
}
},
data: dataResult.valueData,
markPoint: {
data: dataResult.markPoints,
symbolSize: 60,
label: {
color: '#000000',
fontSize: 14,
fontWeight: 'bold',
backgroundColor: 'rgba(255, 255, 255, 0.8)',
borderColor: '#ff0000',
borderWidth: 1,
borderRadius: 4,
padding: [4, 8]
}
},
markArea: {
data: dataResult.markAreas,
silent: true
}
}];
return option;
},
/** 曲线 */
async getChart() {
this.loading = true;
let query = JSON.parse(JSON.stringify(this.queryParams))
try {
const {data} = await steamInstantList(query)
//
const fluxFlowResult = this.processDataBreaks(data, 'fluxFlow')
//
const temperatureResult = this.processDataBreaks(data, 'temperature')
//
const pressResult = this.processDataBreaks(data, 'press')
//
const option1 = this.createChartOption(
'瞬时流量',
fluxFlowResult,
'瞬时流量',
'瞬时流量y',
'#5470c6'
);
const option2 = this.createChartOption(
'温度',
temperatureResult,
'温度',
'温度y',
'#91cc75'
);
const option3 = this.createChartOption(
'压力',
pressResult,
'压力',
'压力y',
'#fac858'
);
this.$refs.Chart1.setData(option1)
this.$refs.Chart2.setData(option2)
this.$refs.Chart3.setData(option3)
echarts.connect(this.$refs.Chart1.chart, this.$refs.Chart2.chart, this.$refs.Chart3.chart)
//
this.$refs.Chart1.chart.on('datazoom', (e) => {
option2.dataZoom[0].start = e.start
option2.dataZoom[0].end = e.end
this.$refs.Chart2.setData(option2)
option3.dataZoom[0].start = e.start
option3.dataZoom[0].end = e.end
this.$refs.Chart3.setData(option3)
})
this.$refs.Chart2.chart.on('datazoom', (e) => {
option1.dataZoom[0].start = e.start
option1.dataZoom[0].end = e.end
this.$refs.Chart1.setData(option1)
option3.dataZoom[0].start = e.start
option3.dataZoom[0].end = e.end
this.$refs.Chart3.setData(option3)
})
this.$refs.Chart3.chart.on('datazoom', (e) => {
option2.dataZoom[0].start = e.start
option2.dataZoom[0].end = e.end
this.$refs.Chart2.setData(option2)
option1.dataZoom[0].start = e.start
option1.dataZoom[0].end = e.end
this.$refs.Chart1.setData(option1)
})
} catch (error) {
console.error('获取图表数据失败:', error)
this.$message.error('获取图表数据失败')
} finally {
this.loading = false
}
},
/** 查询树形结构 */
getTreeMonitorInfo() {
getMonitorInfoTree({ monitorType: 4 }).then(response => {
this.baseMonitorInfoOptions = this.handleTree(response.data, "id", "parentId")
})
}
}
}
</script>
<style scoped >
.app-container {
padding: 10px;
}
.charts-container {
margin-top: 10px;
}
.chart1 {
width: 50%;
height: 40vh;
display: inline-block;
}
.chart2 {
width: 50%;
height: 40vh;
display: inline-block;
}
.chart3 {
width: 50%;
height: 40vh;
display: inline-block;
}
.power-outage-summary {
margin-bottom: 10px;
}
.power-outage-info {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.power-outage-info p {
margin: 5px 10px;
}
/* 选中节点的样式 */
::v-deep .el-tree .el-tree-node.is-current > .el-tree-node__content {
background-color: #67C23A !important; /* 选中节点的背景色 */
color: #303133 !important; /* 选中节点的文字颜色 */
padding: 0; /* 清除内边距 */
margin: 0; /* 清除外边距 */
z-index: 1; /* 确保在其他元素之上 */
}
/* 鼠标悬停时的样式 */
.el-tree .el-tree-node__content:hover {
background-color: #e6f7ff; /* 鼠标悬停时的背景色 */
}
/* 闪电图标 */
.el-icon-lightning:before {
content: "\e6a8"; /* 使用现有的element-ui图标字体 */
}
</style>

@ -101,7 +101,12 @@ import 'vue-datepicker-next/index.css';
export default {
name: 'currentSteamCurve',
dicts: ['collect_type'],
computed: {
collect_type() {
return this.useDict('collect_type').collect_type;
},
},
components: {
Chart,
Treeselect,
@ -234,7 +239,7 @@ export default {
initBaseChartOptions() {
this.baseChartOptions = {
grid: {
top: '15%',
top: '40',
bottom: '10%',
left: '10%',
right: '3%'

@ -79,6 +79,11 @@ import { vibrationInstantList } from '@/api/ems/record/recordVibrationInstant'
export default {
name: 'currentVibrationCurve',
dicts: ['collect_type'],
computed: {
collect_type() {
return this.useDict('collect_type').collect_type;
},
},
components: {
Chart,
Treeselect
@ -268,7 +273,7 @@ export default {
x: 'center'
},
grid: {
top: '15%',
top: '40',
bottom: '10%',
left: '10%',
right: '3%'
@ -361,7 +366,7 @@ export default {
x: 'center'
},
grid: {
top: '15%',
top: '40',
bottom: '10%',
left: '10%',
right: '3%'
@ -455,7 +460,7 @@ export default {
x: 'center'
},
grid: {
top: '15%',
top: '40',
bottom: '10%',
left: '10%',
right: '3%'
@ -548,7 +553,7 @@ export default {
x: 'center'
},
grid: {
top: '15%',
top: '40',
bottom: '10%',
left: '10%',
right: '3%'

@ -165,6 +165,11 @@ let optionData = {}
export default {
name: 'EnergyPreview',
dicts: ['statistical_unit'],
computed: {
statistical_unit() {
return this.useDict('statistical_unit').statistical_unit;
},
},
components: { Treeselect },
data() {
return {

@ -103,6 +103,11 @@ import 'vue-datepicker-next/index.css';
export default {
name: 'currentSteamCurve',
dicts: ['collect_type'],
computed: {
collect_type() {
return this.useDict('collect_type').collect_type;
},
},
components: {
Chart,
Treeselect,

@ -7,7 +7,7 @@
v-model="filterBoxName"
placeholder="请输入计量设备名称"
clearable
prefix-icon="Search"
style="margin-bottom: 20px"
/>
@ -82,7 +82,7 @@
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate()"
v-hasPermi="['ems:reportPointWater:edit']"
@ -106,7 +106,7 @@
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['ems:reportPointWater:export']"
>导出

@ -1,848 +0,0 @@
<template>
<div class="p-2">
<el-card shadow="never">
<el-form label-width="120px" label-position="right" :inline="true" :model="queryForm" class="demo-form-inline">
<el-form-item label="仓库" prop="warehouseId">
<el-select v-model="queryForm.warehouseId" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="出库单号" prop="outstockCode">
<el-input v-model="queryForm.outstockCode" placeholder="请输入出库单号" clearable/>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<template #header>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="parentTableAdd"></el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="ids.length !== 1" @click="parentTableUpdate()">
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="ids.length < 1" @click="parentTableDelete()">
</el-button>
</el-col>
<!-- <el-col :span="1.5">-->
<!-- <el-button type="warning" plain icon="Download" @click="handleExport"></el-button>-->
<!-- </el-col>-->
<right-toolbar v-model:showSearch="showSearch" :columns="columns" :search="true"
@queryTable="getParentTable"></right-toolbar>
</el-row>
</template>
<el-table v-loading="parentTableLoad" :data="parentTableData" style="width: 100%" highlight-current-row
@current-change="parentTableCellClick"
@selection-change="selectionChange" ref="parentTableRef">
<el-table-column type="selection" width="55"/>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="仓库" align="center" prop="warehouseCode"/>
<el-table-column label="出库单号" align="center" prop="outstockCode"/>
<el-table-column label="出库类型" align="center" prop="outstockType">
<template #default="scope">
<dict-tag :options="wms_out_type" :value="scope.row.outstockType"/>
</template>
</el-table-column>
<!-- <el-table-column label="物料大类" align="center" prop="materialCategoryId">
<template #default="scope">
<dict-tag :options="material_mategories" :value="scope.row.materialCategoryId"/>
</template>
</el-table-column>-->
<el-table-column label="工单类型" align="center" prop="orderType">
<template #default="scope">
<dict-tag :options="wms_instock_type" :value="scope.row.orderType"/>
</template>
</el-table-column>
<el-table-column label="订单编号" align="center" prop="orderNo"/>
<el-table-column label="审核人" align="center" prop="auditBy"/>
<el-table-column label="审核时间" align="center" prop="auditTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.auditTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="审核状态" align="center" prop="auditStatus">
<template #default="scope">
<dict-tag :options="approve_status" :value="scope.row.auditStatus"/>
</template>
</el-table-column>
<el-table-column label="审核意见" align="center" prop="auditComments"/>
<!-- <el-table-column label="入库方式" align="center" prop="inMethod">
<template #default="scope">
<dict-tag :options="wms_allocate_way" :value="scope.row.inMethod"/>
</template>
</el-table-column> -->
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<!-- <el-button size="small" @click.stop="viewDetails(scope.row)">-->
<!-- 查看-->
<!-- </el-button>-->
<el-button size="small" @click.stop="parentTableUpdate(scope.row)">
修改
</el-button>
<el-button
size="small"
type="danger"
@click.stop="parentTableDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination v-show="parentTableTotal > 0" :total="parentTableTotal" v-model:page="queryForm.pageNum"
v-model:limit="queryForm.pageSize" @pagination="getParentTable"/>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<el-table :data="childrenTableData" style="width: 100%" v-loading="childrenTableLoad">
<el-table-column label="出库单号" align="center" prop="outstockCode"/>
<!-- <el-table-column label="出库单 主键" align="center" prop="outstockId" v-if="columns[2].visible"/> -->
<el-table-column label="物料" align="center" prop="materialCode"/>
<el-table-column label="出库数量" align="center" prop="outstockQty"/>
<el-table-column label="物料大类" align="center" prop="materialCategoryName">
</el-table-column>
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<!-- <el-button size="small" @click="childrenTableUpdate( scope.row)">
打印
</el-button> -->
<el-button
size="small"
type="danger"
@click="childrenTableUDelete(scope.row)"
>
删除
</el-button>
<!-- <el-tooltip content="打印" placement="top">
<el-button type="primary" @click="handlePrint(scope.row)"></el-button>
</el-tooltip> -->
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="80%">
<el-card shadow="never">
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView">
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="dialogForm.warehouseId" placeholder="请选择所属仓库">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="出库类型" prop="outstockType">
<el-select v-model="dialogForm.outstockType" placeholder="请选择出库类型">
<el-option
v-for="dict in wms_out_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="物料大类" prop="materialCategoryId">
<el-select v-model="dialogForm.materialCategoryId" placeholder="请选择物料大类" @change="setMaterialList">
<el-option v-for="item in mategoryOptions"
:key="item.materialCategoryId"
:label="item.materialCategoryName"
:value="item.materialCategoryId"
/>
</el-select>
</el-form-item>
<el-form-item label="工单类型" prop="orderType">
<el-select v-model="dialogForm.orderType" placeholder="请选择工单类型(字典1销售订单,2生产订单,3手工,4系统生成)">
<el-option
v-for="dict in wms_instock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="审核人" prop="auditBy">
<el-select v-model="dialogForm.auditBy" placeholder="请选择审核人">
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.userName"
:value="item.userName"
/>
</el-select>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 8px" shadow="never">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="addDialogTableCell"></el-button>
</el-col>
</el-row>
<el-table :data="dialogtable" style="width: 100%">
<el-table-column label="物料大类" prop="materialCategoryId">
<el-select v-model="dialogForm.materialCategoryId" placeholder="" :disabled="true">
<el-option v-for="item in mategoryOptions"
:key="item.materialCategoryId"
:label="item.materialCategoryName"
:value="item.materialCategoryId"
/>
</el-select>
</el-table-column>
<el-table-column label="物料编码" prop="materialCode">
<!-- <template #default="scope">
<el-select
v-model="scope.row.materialId"
placeholder="选择物料"
style="width: 240px"
>
<el-option
v-for="i in materialList"
:label="i.materialCode+'('+i.materialName+')'"
:value="i.materialId"
:key="i.materialId"
/>
</el-select>
</template>-->
<template #default="scope">
<el-input
v-model="scope.row.materialCode"
placeholder="请点击检索物料"
@click="handleMaterialAdd('material', scope.$index)" >
<template #append>
<el-icon class="el-input__icon"><search/></el-icon>
</template>
</el-input>
</template>
</el-table-column>
<el-table-column label="物料名称" prop="materialName">
<template #default="scope">
<el-select
v-model="scope.row.materialName"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialName"
:value="i.materialName"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料单位" prop="materialUnit">
<template #default="scope">
<el-select
v-model="scope.row.materialUnit"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialUnit"
:value="i.materialUnit"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="物料规格" prop="materialSpec">
<template #default="scope">
<el-select
v-model="scope.row.materialSpec"
placeholder="选择物料"
style="width: 240px"
:disabled="true"
>
<el-option
v-for="i in materialList"
:label="i.materialSpec"
:value="i.materialSpec"
:key="i.materialId"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="出库数量" prop="outstockQty">
<template #default="scope">
<el-input v-model="scope.row.outstockQty" placeholder="请输入出库数量" style="width: 200px;"/>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" width="200">
<template #default="scope">
<el-button
size="small"
type="danger"
@click="tableUDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
<!-- <el-table-column label="已包数量" prop="printedNum">
<template #default="scope">
<el-input v-model="scope.row.printedNum" placeholder="请输入已包数量" />
</template>
</el-table-column> -->
<!-- <el-table-column label="分包数量" prop="printNum">
<template #default="scope">
<el-input v-model="scope.row.printNum" placeholder="请输入分包数量" />
</template>
</el-table-column>
<el-table-column label="打印数量" prop="barcodeNum">
<template #default="scope">
<el-input v-model="scope.row.barcodeNum" placeholder="请输入打印数量" />
</template> -->
<!-- </el-table-column> -->
<!-- <el-table-column label="erp同步状态" prop="erpSynchronousStatus">-->
<!-- <template #default="scope">-->
<!-- <el-select-->
<!-- v-model="scope.row.erpSynchronousStatus"-->
<!-- placeholder="选择erp同步状态"-->
<!-- >-->
<!-- <el-option-->
<!-- label="1"-->
<!-- value="1"-->
<!-- />-->
<!-- <el-option-->
<!-- label="2"-->
<!-- value="2"-->
<!-- />-->
<!-- </el-select>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
</el-card>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false">关闭</el-button>
<el-button type="primary" @click="dialogSubmit">
确定
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="parentTableInfoVisible" title="修改父表格" width="40%">
<el-form :model="parentTableInfoForm" label-width="120px">
<el-form-item label="仓库ID" prop="warehouseId">
<el-select v-model="parentTableInfoForm.warehouseId" placeholder="请选择所属仓库" :disabled="true">
<el-option
v-for="item in baseStoreList"
:key="item.warehouseId"
:label="item.warehouseName"
:value="item.warehouseId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="出库类型" prop="outstockType">
<el-select v-model="parentTableInfoForm.outstockType" placeholder="请选择出库类型">
<el-option
v-for="dict in wms_out_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="物料大类" prop="materialCategoryId">
<el-select v-model="parentTableInfoForm.materialCategoryId" placeholder="请选择物料大类">
<el-option v-for="item in mategoryOptions"
:key="item.materialCategoryId"
:label="item.materialCategoryName"
:value="item.materialCategoryId"
/>
</el-select>
</el-form-item>
<el-form-item label="工单类型" prop="orderType">
<el-select v-model="parentTableInfoForm.orderType" placeholder="请选择工单类型(字典1销售订单,2生产订单,3手工,4系统生成)" :disabled="true">
<el-option
v-for="dict in wms_instock_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="审核人" prop="auditBy">
<el-select v-model="parentTableInfoForm.auditBy" placeholder="请选择审核人" :disabled="true">
<el-option
v-for="item in userList"
:key="item.userId"
:label="item.userName"
:value="item.userName"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="parentTableInfoVisible = false">关闭</el-button>
<el-button type="primary" @click="parentTableInfoSubmit">
确定
</el-button>
</div>
</template>
</el-dialog>
<el-dialog v-model="childrenTableInfoVisible" title="条码生成" width="40%">
<el-form :model="childrenTableInfoForm" label-width="120px">
<el-form-item label="物料" prop="materialId">
<el-select v-model="childrenTableInfoForm.materialId" placeholder="请选择物料">
<el-option
v-for="item in materialList"
:key="item.materialId"
:label="item.materialCode"
:value="item.materialId"
/>
</el-select>
</el-form-item>
<el-form-item label="入库数量" prop="instockQty">
<el-input v-model="childrenTableInfoForm.instockQty" placeholder="请输入入库数量" />
</el-form-item>
<el-form-item label="有无条码" prop="codeYesNo">
<el-radio-group v-model="childrenTableInfoForm.codeYesNo">
<el-radio
v-for="dict in wms_barcode_if"
:key="dict.value"
:value="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="已包数量" prop="printedNum">
<el-input v-model="childrenTableInfoForm.printedNum" placeholder="" />
</el-form-item>
<el-form-item label="分包数量" prop="printNum">
<el-input v-model="childrenTableInfoForm.printNum" placeholder="请输入分包数量" />
</el-form-item>
<el-form-item label="打印数量" prop="barcodeNum">
<el-input v-model="childrenTableInfoForm.barcodeNum" placeholder="请输入打印条码数量" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="childrenTableInfoVisible = false">关闭</el-button>
<el-button type="primary" @click="submitForm">
确定
</el-button>
</div>
</template>
</el-dialog>
<!-- 添加物料信息对话框 -->
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
<MaterialSelectInWMS
@selection="handleSelection"
ref="materialSelectRef"
v-if="materialOpen"
:materialCategoryId="dialogForm.materialCategoryId"
></MaterialSelectInWMS>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitMaterialForm"> </el-button>
<el-button @click="materialOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script setup name="Linkage" lang="ts">
import { listOutstockOrder, getOutstockOrder, delOutstockOrder, addOutstockOrder, updateOutstockOrder } from '@/api/wms/outstockOrder';
import { OutstockOrderVO, OutstockOrderQuery, OutstockOrderForm } from '@/api/wms/outstockOrder/types';
import {reactive} from 'vue'
import {ElMessage, ElMessageBox} from 'element-plus'
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
import {UserVO} from "@/api/system/user/types";
import {listUser} from "@/api/system/user";
import { listOutstockDetail, getOutstockDetail, delOutstockDetail, addOutstockDetail, updateOutstockDetail } from '@/api/wms/outstockDetail';
import { OutstockDetailVO, OutstockDetailQuery, OutstockDetailForm } from '@/api/wms/outstockDetail/types';
import { getMaterialListVo, getMaterailCount } from '@/api/wms/instockDetail';
import {
getMaterialList
} from '@/api/wms/linkage'
import MaterialSelectInWMS from "@/views/wms/baseMaterialInfo/addMaterialInWMS.vue";
import { getBaseMaterialCategoryListInWMS } from '@/api/wms/baseMaterialCategory';
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const {
wms_out_type,
wms_barcode_if,
wms_instock_type,
approve_status,
erp_synchronous_status,
material_mategories,
mes_material_categories,
wms_allocate_status,
wms_allocate_create,
wms_allocate_way
} = toRefs<any>(proxy?.useDict('wms_out_type', 'wms_barcode_if', 'wms_instock_type', 'approve_status', 'erp_synchronous_status', 'material_mategories', 'mes_material_categories', 'wms_allocate_status', 'wms_allocate_create', 'wms_allocate_way'));
interface User {
date: string
name: string
address: string
}
const parentTableTotal = ref(0)
const dialogVisible = ref(false)
const parentTableInfoVisible = ref(false)
const childrenTableInfoVisible = ref(false)
// const childrenTableInfoSubmit = ref(false)
const updateDialog = ref(false)
const dialogTitle = ref('添加')
const dialogForm = ref({})
const parentTableInfoForm = ref({})
const childrenTableInfoForm = ref({})
const queryForm = ref({
outstockCode: '',
materialCategoryId: '',
materialCategoryName: '',
warehouseId: '',
pageNum: 1,
pageSize: 10
})
const parentTableRef = ref()
const parentTableData = ref([])
const ids = ref([])
const childrenTableData = ref([])
const dialogtable = ref([])
const baseStoreList = ref([]);
const userList = ref([]);
const materialList = ref([]);
const parentTableLoad = ref(false)
const childrenTableLoad = ref(false)
const isView = ref(false)
const partntTableSelectCell = ref({})
let supplierList = ref([]);
/** 查询出库单大类下物料数量接口 */
const getMaterialCount = async () => {
const materialId = form.value.materialId
console.log(materialId)
const res = await getMaterailCount({'materialId':materialId});
console.log(res.data);
form.value.stockQty = res.data;
console.log(form.stockQty)
}
//
getBaseWarehouseList().then(e => {
baseStoreList.value = e.data
})
listUser().then(e => {
userList.value = e.rows;
})
/** 提交按钮 */
const submitForm = () => {
updateInstockDetail(childrenTableInfoForm.value).finally(() => childrenTableInfoVisible.value = false);
}
let mategoryOptions = ref([]);
const getMaterialCategorySelect = async () => {
const res = await getBaseMaterialCategoryListInWMS(null);
mategoryOptions.value = res.data;
};
//
const getParentTable = async () => {
await getMaterialCategorySelect();
parentTableLoad.value = true
await listOutstockOrder(queryForm.value).then(async (e) => {
parentTableLoad.value = false
parentTableData.value = e.rows
parentTableTotal.value = e.total
if (e.rows.length > 0) {
parentTableRef.value.setCurrentRow(e.rows[0])
await getChildrenTable({outstockId: e.rows[0].outstockId})
} else {
childrenTableData.value = []
}
})
}
//
const getChildrenTable = async (form) => {
childrenTableLoad.value = true
console.log(form)
await listOutstockDetail(form).then(e => {
childrenTableLoad.value = false
childrenTableData.value = e.rows
// parentTableTotal.value = e.total
})
}
getParentTable()
/** 打印按钮操作 */
const handlePrint = async (row?: InstockDetailVO) => {
reset();
const _instockDetailId = row?.instockDetailId || ids.value[0]
const res = await getInstockDetail(_instockDetailId);
Object.assign(childrenTableInfoForm.value, res.data);
}
//
const query = async () => {
ids.value = []
parentTableRef.value?.clearSelection()
await getParentTable()
}
const reset = () => {
queryForm.value = {
instockId: ''
}
}
//
const parentTableCellClick = async (e) => {
partntTableSelectCell.value = e
await getChildrenTable({outstockId: e.outstockId})
}
//
const selectionChange = (e) => {
ids.value = e.map(v => v.outstockId)
}
//
const viewDetails = (e) => {
isView.value = true
dialogVisible.value = true
viewAllocateOrder(e.aoId).then(v => {
dialogForm.value = v.data
})
}
//
const parentTableAdd = () => {
dialogVisible.value = true
dialogForm.value = {}
dialogtable.value = []
}
//
const parentTableUpdate = async (e) => {
let id = ref(null)
if (e) {
id.value = e.outstockId
} else {
id.value = ids.value?.[0]
}
if (!id.value) return
parentTableInfoForm.value = (await getOutstockOrder(id.value)).data
parentTableInfoVisible.value = true
updateDialog.value = true
}
//
const parentTableDelete = async (e) => {
const delList = ref([])
if (e) {
delList.value = [e.outstockId]
} else {
delList.value = ids.value
}
ElMessageBox.confirm(
'确定要删除这些数据吗?',
'Warning',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
await delOutstockOrder(delList.value.toString()).then(e => {
ElMessage({
type: 'success',
message: '删除完成',
})
getParentTable()
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消',
})
})
}
//
const setMaterialList = (materialCategoryId) => {
getMaterialList({materialCategoryId}).then(e => {
materialList.value = e.data
})
}
//
const addDialogTableCell = () => {
dialogtable.value.push({})
}
//
const dialogSubmit = () => {
addOutstockOrder(dialogForm.value).then(e => {
addOutstockDetail(dialogtable.value.map(item => {
return {...item, outstockCode: e.data.outstockCode,outstockId: e.data.outstockId, materialCategoryId: e.data.materialCategoryId}
}
)
).then(v => {
dialogVisible.value = false
getParentTable()
})
})
}
const parentTableInfoSubmit = () =>{
updateOutstockOrder(parentTableInfoForm.value).then(e=>{
ElMessage({
type: 'success',
message: '修改完成',
})
parentTableInfoVisible.value = false
getParentTable()
})
}
//
const childrenTableUpdate = async (e) => {
childrenTableInfoForm.value = (await getInstockDetail(e.instockDetailId)).data
childrenTableInfoVisible.value = true
}
//
const tableUDelete = (row) => {
ElMessageBox.confirm(
'确定要删除这些数据吗?',
'Warning',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
const index = dialogtable.value.indexOf(row);
console.log(index)
dialogtable.value.splice(index,1)
})
}
//
const childrenTableUDelete = (e) => {
ElMessageBox.confirm(
'确定要删除这些数据吗?',
'Warning',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(async () => {
await delOutstockDetail(e.outstockDetailId).then(async (e) => {
ElMessage({
type: 'success',
message: '删除完成',
})
await getChildrenTable({outstockId: partntTableSelectCell.value.outstockId})
})
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消',
})
})
}
/* 以下为添加物料信息对话框相关方法 */
let materialSelectRef = ref();//
const materialOpen = ref(false);//
const selectType = ref(''); //
const selectedMaterial = ref(null); //
const currentRowIndex = ref(-1); //
/** 处理从MaterialSelect组件接收到的选择 */
const handleSelection = (row) => {
selectedMaterial.value = row;
};
/** 提交物料BOM信息按钮 */
const submitMaterialForm = () => {
if (!selectedMaterial.value) {
//
selectedMaterial.value = materialSelectRef.value.tableRef.store.states.currentRow.value;
}
if (selectedMaterial.value) {
if (selectType.value === 'material') {
//
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
dialogtable.value[currentRowIndex.value].materialId = selectedMaterial.value.materialId;
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
dialogtable.value[currentRowIndex.value].materialCode = selectedMaterial.value.materialCode;
dialogtable.value[currentRowIndex.value].materialUnit = selectedMaterial.value.materialUnit;
dialogtable.value[currentRowIndex.value].materialSpec = selectedMaterial.value.materialSpec;
//
}
}
}
//
selectedMaterial.value = null;
materialOpen.value = false;
};
/** 新增按钮操作 */
const handleMaterialAdd = (type, index) => {
selectType.value = type;
currentRowIndex.value = index; //
materialOpen.value = true;
}
</script>
<style>
.demo-form-inline .el-input {
--el-input-width: 220px;
}
.demo-form-inline .el-select {
--el-select-width: 220px;
}
</style>
Loading…
Cancel
Save