This commit is contained in:
shijing 2024-10-08 13:52:54 +08:00
commit 5ad7678d04
12 changed files with 594 additions and 13 deletions

View File

@ -84,6 +84,7 @@
placeholder="名称/代号"
style="width: 200px"
clearable
@keyup.enter="handleQuery"
></el-input>
<el-button
type="primary"

View File

@ -139,6 +139,7 @@
clearable
filterable
style="width: 100%"
@clear="() => { form.material=null } "
>
<el-option
v-for="item in materials"

View File

@ -93,8 +93,8 @@
<th rowspan="2">车间用水t</th>
</tr>
<tr v-if="deptName=='烧成车间'">
<th colspan="11">回转窑</th>
<th colspan="3">煤磨</th>
<th colspan="10">回转窑</th>
<th colspan="4">煤磨</th>
<th rowspan="2">压缩空气m3</th>
<th rowspan="2">车间用水t</th>
</tr>

View File

@ -286,9 +286,9 @@
},
getTableData(){
for(let i=0;i<39;i++){
this.tableDatas[i][3] = '';
}
// for(let i=0;i<39;i++){
// this.tableDatas[i][3] = '';
// }
this.getData();
},
handlePrint() {

View File

@ -39,7 +39,7 @@
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" v-if="form.shift_name == '白班' && mgroupId == '3347217246321065984'">
<el-form-item label="煤粉热值">
<el-form-item label="煤粉热值(大卡)">
<el-input-number v-model="form.pcoal_heat" controls-position="right" placeholder="煤粉热值" />
</el-form-item>
</el-col>

View File

@ -113,9 +113,9 @@
<el-col
:md="12"
:sm="24"
v-if="form.mgroup_name == '回转窑'"
v-if="form.mgroup_name == '回转窑' && (form.shift_name == '白班' || form.shift_name == '早班')"
>
<el-form-item label="煤粉热值">
<el-form-item label="煤粉热值(大卡)">
<el-input-number
v-model="form.pcoal_heat"
controls-position="right"
@ -461,8 +461,8 @@
prop="measure"
></el-table-column>
<el-table-column
label="停机时长"
prop="duration"
label="停机时长(s)"
prop="duration_sec"
></el-table-column>
<el-table-column
label="操作"
@ -810,6 +810,7 @@ export default {
})
.catch((res) => {
that.isSaveing = false;
});
}
});

View File

@ -0,0 +1,40 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-segmented v-model="value" :options="options" size="large" />
</div>
</el-header>
<el-main class="nopadding">
<TaskResult v-if="value == 0" />
<Xscript v-if="value == 1" />
</el-main>
</el-container>
</template>
<script>
import Xscript from './xscript.vue'
import TaskResult from './taskresult.vue'
export default {
components: {
Xscript, TaskResult
},
data() {
return {
value: 0,
options: [{
label: '任务执行',
value: 0
},
{
label: '数据转储',
value: 1
}
]
}
},
methods: {
}
}
</script>

View File

@ -0,0 +1,234 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-select
v-model="query.mpoint"
placeholder="测点"
clearable
filterable
style="margin: 0 6px; width: 300px"
@change="handleQuery"
>
<el-option
v-for="item in mpoints"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
<el-select
v-model="query.type"
placeholder="类型"
style="margin: 0 6px; width: 120px"
@change="handleQuery"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
<el-date-picker v-model="timeRange" type="datetimerange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" @change="handleQuery"
style="width: 100%" />
<el-button
type="primary"
icon="el-icon-search"
style="margin-left: 6px"
@click="handleQuery"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
stripe
:params="params"
:query="query"
highlightCurrentRow
@row-click="rowClick"
>
<el-table-column type="index" width="50" />
<el-table-column label="测点" prop="mpoint_name">
</el-table-column>
<el-table-column label="所属集合" prop="mgroup_name">
</el-table-column>
<el-table-column label="类型" prop="type" width="80"> </el-table-column>
<el-table-column label="年" prop="year" width="80"> </el-table-column>
<el-table-column label="班年" prop="year_s" width="80"> </el-table-column>
<el-table-column label="月" prop="month" width="50"> </el-table-column>
<el-table-column label="班月" prop="month_s" width="50"> </el-table-column>
<el-table-column label="日" prop="day" width="50"> </el-table-column>
<el-table-column label="班日" prop="day_s" width="50"> </el-table-column>
<el-table-column label="时" prop="hour" width="50"> </el-table-column>
<el-table-column label="当前值" prop="val"></el-table-column>
<el-table-column
label="校正值"
prop="val_correct"
></el-table-column>
<el-table-column
label="原始计算值"
prop="val_origin"
></el-table-column>
<el-table-column
label="操作"
fixed="right"
align="center"
width="140"
>
<template #default="scope">
<el-button
link
size="small"
v-if="scope.row.type == 'year_s' || scope.row.type == 'month_s' || scope.row.type == 'day_s'"
@click="handle_edit(scope.row)"
type="primary"
>校正</el-button
>
</template>
</el-table-column>
</scTable>
</el-main>
<el-dialog title="校正" v-model="visible">
<el-main style="padding: 0 20px 20px 20px">
<el-form
ref="dialogForm"
:model="form"
label-position="right"
label-width="80px"
style="padding: 0 10px"
>
<el-row>
<el-col :md="8" :sm="24">
<el-form-item label="所属部门">
<span>{{ form.belong_dept_name }}</span>
</el-form-item>
</el-col>
<el-col :md="8" :sm="24">
<el-form-item label="工段名称">
<span>{{ form.mgroup_name }}</span>
</el-form-item>
</el-col>
<el-col :md="8" :sm="24">
<el-form-item label="测点名">
<span>{{ form.mpoint_name }}</span>
</el-form-item>
</el-col>
<el-col :md="8" :sm="24">
<el-form-item label="时间范围">
<span>{{ form.year_s }}/{{ form.month_s }}/{{ form.day_s }}</span>
</el-form-item>
</el-col>
<el-col :md="8" :sm="24">
<el-form-item label="校正值">
<el-input-number
v-model="form.val_correct"
:min="0"
controls-position="right"
></el-input-number>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" :loading="isSaveing" @click="submit"
>保存</el-button
>
<el-button @click="visible = false">取消</el-button>
</el-footer>
</el-dialog>
</el-container>
</template>
<script>
export default {
name: "sflog",
data() {
return {
apiObj: this.$API.enm.mpoint.stat,
params: {},
query: {
mpoint: null,
type: "hour",
start_time: null,
end_time: null
},
options: [
{ label: "小时", value: "hour"},
{ label: "天", value: "day" },
{ label: "月", value: "month"},
{ label: "班天", value: "day_s" },
{ label: "班月", value: "month_s" },
],
form: {
id: "",
val_correct: "",
},
visible: false,
mpoints: [],
timeRange: []
};
},
mounted() {
this.getMpoints();
},
methods: {
getMpoints() {
let that = this;
this.$API.enm.mpoint.list
.req({ page: 0})
.then((res) => {
that.mpoints = res;
});
},
handle_add() {},
handleQuery() {
console.log(this.query)
if (this.timeRange) {
this.query.start_time = this.timeRange[0]
this.query.end_time = this.timeRange[1]
} else {
this.query.start_time = null
this.query.end_time = null
}
this.$refs.table.queryData(this.query);
},
//
handle_edit(row) {
this.form = { ...row };
this.form.val_correct = row.val;
this.visible = true;
},
//
submit() {
this.$refs.dialogForm.validate((valid) => {
if (valid) {
this.isSaveing = true;
let obj = {};
obj.val_correct = this.form.val_correct;
this.$API.enm.mpointstat.correct
.req(this.form.id, obj)
.then((res) => {
this.isSaveing = false;
this.visible = false;
this.$refs.table.queryData(this.query);
})
.catch((e) => {
this.isSaveing = false;
});
}
});
},
},
};
</script>
<style scoped>
.searchBtn {
margin-left: 5px;
}
</style>

View File

@ -0,0 +1,75 @@
<template>
<el-container>
<el-header>
<div class="right-panel">
<el-select v-model="query.status" placeholder="执行状态" clearable @change="handleQuery">
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
<el-date-picker v-model="timeRange" type="datetimerange" range-separator=""
start-placeholder="开始时间" end-placeholder="结束时间" clearable @change="handleQuery"/>
</div>
</el-header>
<el-main>
<scTable ref="table" :apiObj="apiObj" :params="params" @row-click="itemDetail">
<el-table-column label="执行ID" prop="task_id" width="280" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="名称" prop="periodic_task_name" width="240" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="执行方法" prop="task_name" width="260" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="状态" prop="status" width="80" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="执行返回" prop="result" width="180" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="开始时间" prop="date_created" width="160" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="结束时间" prop="date_done" width="160" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="错误信息" prop="traceback" min-width="80" :show-overflow-tooltip="true"></el-table-column>
</scTable>
</el-main>
<el-dialog v-model="dVisible" title="详情">
<el-descriptions :column="1" border>
<el-descriptions-item label="开始执行" width="80">{{ current_tr.date_created }}</el-descriptions-item>
<el-descriptions-item label="结束执行">{{ current_tr.date_created }}</el-descriptions-item>
<el-descriptions-item label="执行状态">{{ current_tr.status }}</el-descriptions-item>
<el-descriptions-item label="返回结果">{{ current_tr.result }}</el-descriptions-item>
<el-descriptions-item label="错误信息">{{ current_tr.traceback }}</el-descriptions-item>
</el-descriptions>
</el-dialog>
</el-container>
</template>
<script>
export default {
data() {
return {
apiObj: this.$API.system.task.result,
params: {
task_name__in: "apps.enm.tasks.cal_mpointstats"
},
timeRange:[],
query: {},
statusOptions: [
{label: 'SUCCESS', value: 'SUCCESS'},
{label: 'FAILURE', value: 'FAILURE'},
{label: 'REVOKED', value: 'REVOKED'},
{label: 'PENDING', value: 'PENDING'},
{label: 'RETRY', value: 'RETRY'},
],
dVisible: false,
current_tr: {}
}
},
methods: {
itemDetail(row){
this.dVisible = true;
this.current_tr = row;
},
handleQuery(){
if(this.timeRange){
this.query.date_created__gte = this.timeRange[0]
this.query.date_created__lte = this.timeRange[1]
}
else{
this.query.date_created__gte = null
this.query.date_created__lte = null
}
this.$refs.table.queryData(this.query)
}
}
}
</script>

View File

@ -0,0 +1,224 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button
type="primary"
icon="el-icon-plus"
@click="add"
v-auth="'xscript.create'"
></el-button>
</div>
</el-header>
<el-main class="nopadding">
<scTable ref="table" :apiObj="apiObj" hidePagination>
<el-table-column label="#" type="index" width="50">
<template #default="scope">
<el-link type="primary" @click="lastDetail(scope.row)">{{ scope.$index + 1 }}</el-link>
</template>
</el-table-column>
<el-table-column label="名称" prop="name" min-width="240" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="时间策略" prop="myschedule_name" min-width="300" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="是否启用" width="80" :show-overflow-tooltip="true">
<template #default="scope">
<el-icon v-if="scope.row.enabled" color="green"
><CircleCheckFilled
/></el-icon>
</template>
</el-table-column>
<el-table-column label="运行次数" prop="total_run_count" width="80" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="最后运行时间" prop="last_run_at" width="160" :show-overflow-tooltip="true"></el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="200">
<template #default="scope">
<el-button plain type="warning" size="small" @click="table_toggle(scope.row, scope.$index)"
v-auth="'xscript.update'">/</el-button>
<el-button plain type="warning" size="small" @click="table_edit(scope.row, scope.$index)"
v-auth="'xscript.update'">编辑</el-button>
<el-popconfirm title="确定删除吗?" @confirm="table_del(scope.row, scope.$index)">
<template #reference>
<el-button plain type="danger" size="small" v-auth="'xscript.delete'">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
</el-main>
<el-drawer
title="新增/编辑"
v-model="visible"
:size="1000"
destroy-on-close
>
<el-container>
<el-main style="padding: 0 20px 20px 20px">
<el-form ref="rForm" :model="form">
<el-form-item label="脚本名称" required>
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="脚本内容" required>
<Codemirror
v-model:value="form.code"
:options="cmOptions"
border
ref="cmRef"
height="300"
width="100%"
style="line-height: 180%"
>
</Codemirror>
</el-form-item>
<el-form-item label="基础数据">
<JsonEditorVue
style="width: 100%"
v-model="form.base_data"
/>
</el-form-item>
<el-form-item label="变动数据">
<el-button type="warning" @click="openCdg" size="small">变更</el-button><span> ------ {{ form.change_data }}</span>
</el-form-item>
<el-form-item label="时间策略" required>
<el-select
v-model="form.myschedule"
style="width: 100%"
>
<el-option
v-for="item in schOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-form>
</el-main>
<el-footer>
<el-button type="primary" @click="submit">提交</el-button>
</el-footer>
</el-container>
</el-drawer>
<el-dialog title="最后执行" v-model="detailVisible">
<el-descriptions :column="1" border v-if="detailForm.last_run_data != null">
<el-descriptions-item label="开始执行">{{ detailForm.last_run_data.date_created }}</el-descriptions-item>
<el-descriptions-item label="结束执行">{{ detailForm.last_run_data.date_created }}</el-descriptions-item>
<el-descriptions-item label="执行状态">{{ detailForm.last_run_data.status }}</el-descriptions-item>
<el-descriptions-item label="返回结果">{{ detailForm.last_run_data.result }}</el-descriptions-item>
<el-descriptions-item label="错误信息">{{ detailForm.last_run_data.traceback }}</el-descriptions-item>
</el-descriptions>
</el-dialog>
<el-dialog title="变更数据" v-model="cDgVisible">
<JsonEditorVue
style="width: 100%"
v-model="xdata"
/>
<el-footer>
<el-button type="primary" @click="submit2">提交</el-button>
</el-footer>
</el-dialog>
</el-container>
</template>
<script>
import JsonEditorVue from "json-editor-vue3";
import "codemirror/mode/python/python.js";
import 'codemirror/lib/codemirror.css'
import Codemirror from "codemirror-editor-vue3";
const dForm = {
base_data: {},
};
export default {
components: { JsonEditorVue, Codemirror },
data() {
return {
apiObj: this.$API.enm.xscript.list,
visible: false,
form: {},
detailForm: {},
detailVisible: false,
schOptions: [],
cmOptions: {
mode: "text/x-python",
theme: "default",
readOnly: false,
lineNumbers: true,
lineWiseCopyCut: true,
// gutters: ["CodeMirror-lint-markers"],
lint: true,
autoRefresh: true
},
cDgVisible: false,
xdata: {}
};
},
mounted() {
this.getSchOptions();
},
methods: {
openCdg(){
this.xdata = Object.assign({}, this.form.change_data)
this.cDgVisible = true;
},
lastDetail(row) {
this.$API.enm.xscript.item.req(row.id).then(res=>{
this.detailForm = res
this.detailVisible = true
})
},
getSchOptions() {
this.$API.system.myschedule.list.req({ page: 0 }).then((res) => {
this.schOptions = res;
});
},
add() {
this.form = Object.assign({}, dForm);
this.visible = true;
this.$nextTick(() => {
this.$refs.cmRef.refresh()
})
},
table_edit(row) {
this.$API.enm.xscript.item.req(row.id).then(res=>{
this.form = res
this.visible = true
})
},
table_del(row) {
this.$API.enm.xscript.delete.req(row.id).then(()=>{
this.$message.success('删除成功')
this.$refs.table.refresh()
})
},
table_toggle(row) {
this.$API.enm.xscript.toggle.req(row.id).then(() => {
this.$message.success("操作成功");
this.$refs.table.refresh();
})
},
submit2() {
this.$API.enm.xscript.change_data.req(this.form.id, {change_data: this.xdata}).then(() => {
this.$message.success("操作成功");
this.form.change_data = this.xdata;
this.cDgVisible = false;
})
},
submit() {
this.$refs.rForm.validate(async (valid)=>{
if(valid){
if(this.form.id){
this.$API.enm.xscript.update.req(this.form.id, this.form).then(()=>{
this.$message.success('更新成功')
this.visible = false
this.$refs.table.refresh()
})
}else{
this.$API.enm.xscript.create.req(this.form).then(()=>{
this.$message.success('添加成功')
this.visible = false
this.$refs.table.refresh()
})
}
}
})
},
},
};
</script>

View File

@ -17,9 +17,13 @@
<scTable ref="table" :apiObj="apiObj" row-key="id" :params="query" fit stripe
@selection-change="handleSelectionChange" @resetQuery="resetQuery">
<el-table-column type="selection" width="55" />
<el-table-column label="发生类型" prop="buy_date">
<el-table-column label="发生类型">
<template #default="scope">
<el-tag v-for="item in scope.row.cates_" :key="item.id" type="warning" effect="plain">{{ item.name
}}</el-tag>
</template>
</el-table-column>
<el-table-column label="事件信息" prop="voice_msg" show-overflow-tooltip>
<el-table-column label="事件信息" prop="voice_msg" width="300" show-overflow-tooltip>
</el-table-column>
<el-table-column label="所属工段" prop="mgroupName">
<template #default="scope">

View File

@ -151,8 +151,9 @@ export default {
addMenu() {
this.type = "add";
this.limitedVisible = true;
this.addForm = Object.assign({}, dForm);
this.$nextTick(() => {
this.addForm = Object.assign({}, dForm);
// this.addForm = Object.assign({}, dForm);
});
},
//