This commit is contained in:
shijing 2024-12-05 17:19:17 +08:00
commit 4909cadf77
2 changed files with 25 additions and 30 deletions

View File

@ -1,6 +1,6 @@
<template>
<div>
<el-input ref="inputRef" v-model="selectLabel" :readonly="true">
<el-input ref="inputRef" v-model="selectLabel" :readonly="true" :placeholder="placeholder">
<template #prefix v-if="edit">
<el-button
text
@ -72,6 +72,7 @@ import { ref, defineProps, defineEmits, computed, onMounted } from "vue";
const props = defineProps({
multiple: { type: Boolean, default: false },
placeholder: { type: String, default: "请选择" },
edit: { type: Boolean, default: true },
hidePagination: { type: Boolean, default: false },
tableWidth: { type: Number, default: 600 },
@ -171,6 +172,7 @@ const rowClick = (row) => {
selectValue.value = row[props.valueField];
showPopover.value = false;
}
emit("change");
};
const handleClear = () => {
@ -183,6 +185,7 @@ const handleClear = () => {
selectValue.value = null;
}
emit("update:label", "");
emit("change");
};
const tdChange = (res, tableData) => {
@ -198,7 +201,8 @@ const selectionChange = (val) => {
selectLabel.value = val
.map((item) => item[props.labelField])
.join(props.splitField);
emit("update:label", val);
}
emit("update:label", val);
emit("change");
};
</script>

View File

@ -2,21 +2,18 @@
<el-container>
<el-header>
<div class="left-panel">
<el-select
<xtSelect
:apiObj="apiObjM"
:params="paramsM"
v-model="query.mpoint"
placeholder="测点"
clearable
filterable
style="margin: 0 6px; width: 300px"
style="width: 500px"
@change="handleQuery"
placeholder="选择测点"
>
<el-option
v-for="item in mpoints"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-table-column label="测点名" prop="name"></el-table-column>
<el-table-column label="别名" prop="nickname"></el-table-column>
<el-table-column label="计量物料" prop="material_name"></el-table-column>
</xtSelect>
<el-select
v-model="query.type"
placeholder="类型"
@ -44,7 +41,7 @@
</el-header>
<el-main class="nopadding">
<el-container>
<el-aside style="width: 50%; float: right;">
<el-aside style="width: 60%; float: right;">
<!-- 折线图组件 -->
<scTable
ref="table"
@ -57,11 +54,11 @@
@row-click="rowClick"
@dataChange="dataChange"
>
<el-table-column label="测点" prop="mpoint_name" min-width="100">
<el-table-column label="测点" prop="mpoint_name" min-width="160">
</el-table-column>
<el-table-column label="所属集合" prop="mgroup_name">
</el-table-column>
<el-table-column label="类型" prop="type" width="70"> </el-table-column>
<el-table-column label="类型" prop="type" width="75"> </el-table-column>
<el-table-column label="年" prop="year" width="60"> </el-table-column>
<el-table-column label="班年" prop="year_s" width="60"> </el-table-column>
<el-table-column label="月" prop="month" width="50"> </el-table-column>
@ -161,6 +158,8 @@ export default {
name: "sflog",
data() {
return {
apiObjM: this.$API.enm.mpoint.list,
paramsM: {material__isnull: 0},
apiObj: this.$API.enm.mpoint.stat,
params: {
type: "day_s",
@ -226,16 +225,17 @@ export default {
val_correct: "",
},
visible: false,
mpoints: [],
timeRange: []
};
},
mounted() {
this.getMpoints();
},
methods: {
dataChange(req, tableData) {
let that = this;
if(that.query.mpoint == null) {
return
}
let option = { ...that.chartOption };
// x query.type
if (that.query.type == "hour") {
@ -249,10 +249,10 @@ export default {
option.xAxis.data = tableData.reverse().map((item, index) => item.year + "-" + item.month);
}else if (that.query.type == "day_s") {
option.title.text = "班天统计";
option.xAxis.data = tableData.length > 0 ? tableData.reverse().map((item, index) => item.day_s) : [];
option.xAxis.data = tableData.reverse().map((item, index) => item.year_s + "-" + item.month_s + "-" + item.day_s);
}else if (that.query.type == "month_s") {
option.title.text = "班月统计";
option.xAxis.data = tableData.length > 0 ? tableData.reverse().map((item, index) => item.month_s) : [];
option.xAxis.data = tableData.reverse().map((item, index) => item.year_s + "-" + item.month_s);
}
// y
option.series = [
@ -267,15 +267,6 @@ export default {
//
that.chartOption = option;
},
getMpoints() {
let that = this;
this.$API.enm.mpoint.list
.req({ page: 0})
.then((res) => {
that.mpoints = res;
});
},
handle_add() {},
handleQuery() {
if (this.timeRange) {