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

View File

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