Merge pull request 'projects/mes-lb' (#114) from projects/mes-lb into projects/mes-test
Reviewed-on: #114
This commit is contained in:
commit
51f72ea5d2
@ -166,13 +166,17 @@ export default {
|
||||
input: true,
|
||||
label: '参数列名',
|
||||
prop: 'plcParamName',
|
||||
rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '参数名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '参数名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '参数名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@ -419,35 +423,35 @@ export default {
|
||||
},
|
||||
|
||||
// 提交属性表
|
||||
async submitAttrForm() {
|
||||
this.$refs['attrForm'].validate((valid) => {
|
||||
submitAttrForm() {
|
||||
this.$refs['attrForm'].validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
const isEdit = this.attrForm.id != null;
|
||||
this.attrFormSubmitting = true;
|
||||
const res = await this.$axios({
|
||||
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
|
||||
method: isEdit ? 'put' : 'post',
|
||||
data: {
|
||||
...this.attrForm,
|
||||
connectId: this.infoData.id
|
||||
},
|
||||
});
|
||||
|
||||
if (res.code == 0) {
|
||||
this.closeAttrForm();
|
||||
this.$message({
|
||||
message: `${isEdit ? '更新' : '创建'}成功`,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getAttrList();
|
||||
const isEdit = this.attrForm.id != null;
|
||||
this.attrFormSubmitting = true;
|
||||
const res = await this.$axios({
|
||||
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
|
||||
method: isEdit ? 'put' : 'post',
|
||||
data: {
|
||||
...this.attrForm,
|
||||
connectId: this.infoData.id,
|
||||
},
|
||||
});
|
||||
}
|
||||
this.attrFormSubmitting = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
this.closeAttrForm();
|
||||
this.$message({
|
||||
message: `${isEdit ? '更新' : '创建'}成功`,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getAttrList();
|
||||
},
|
||||
});
|
||||
}
|
||||
this.attrFormSubmitting = false;
|
||||
});
|
||||
},
|
||||
|
||||
closeAttrForm() {
|
||||
|
281
src/views/equipment/base/alarm/Record/AddOrUpdate.vue
Normal file
281
src/views/equipment/base/alarm/Record/AddOrUpdate.vue
Normal file
@ -0,0 +1,281 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-11 20:33:12
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="alarm-handle">
|
||||
<DialogForm
|
||||
ref="orderForm"
|
||||
key="orderForm"
|
||||
v-model="orderForm"
|
||||
:disabled="readOnly"
|
||||
:has-files="false"
|
||||
label-position="top"
|
||||
:rows="orderFormRows" />
|
||||
|
||||
<small-title style="margin: 16px 0" :no-padding="true" size="sm">
|
||||
处理方式
|
||||
</small-title>
|
||||
|
||||
<DialogForm
|
||||
key="handleMethodForm"
|
||||
ref="handleMethodForm"
|
||||
v-model="handleMethodForm"
|
||||
:disabled="readOnly"
|
||||
:has-files="true"
|
||||
label-position="top"
|
||||
:rows="handleMethodFormRows" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SmallTitle from './SmallTitle';
|
||||
import { getworkerAll } from '@/api/base/materialUseLog';
|
||||
import Editor from '@/components/Editor';
|
||||
import DialogForm from '@/components/DialogForm';
|
||||
|
||||
export default {
|
||||
name: 'AlarmHandle',
|
||||
props: ['readOnly', 'logId'],
|
||||
components: { SmallTitle, DialogForm, Editor },
|
||||
data() {
|
||||
return {
|
||||
orderForm: {
|
||||
id: null,
|
||||
equipment: null,
|
||||
createTime: null,
|
||||
alarmContent: null,
|
||||
alarmValue: null,
|
||||
// 缺少报警编号字段, 用 alarmValue 代替
|
||||
},
|
||||
orderFormRows: [
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '设备编码',
|
||||
prop: 'equipment',
|
||||
},
|
||||
{
|
||||
datetime: true,
|
||||
label: '报警时间',
|
||||
prop: 'createTime',
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '报警编号',
|
||||
prop: 'alarmValue',
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '报警内容',
|
||||
prop: 'alarmContent',
|
||||
},
|
||||
],
|
||||
],
|
||||
handleMethodFormRows: [
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '处理人',
|
||||
prop: 'hander',
|
||||
url: '/base/core-worker/listAll',
|
||||
rules: [
|
||||
{ required: true, message: '类型名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
upload: true,
|
||||
label: '上传资料',
|
||||
prop: 'files',
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
key: 'handerMode',
|
||||
subcomponent: Editor,
|
||||
label: '处理方式',
|
||||
prop: 'handerMode',
|
||||
bind: {
|
||||
'min-height': 200,
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
handleMethodForm: {
|
||||
id: null,
|
||||
logId: null,
|
||||
hander: null,
|
||||
handerMode: null,
|
||||
remark: null,
|
||||
files: [
|
||||
// {
|
||||
// fileName: '',
|
||||
// fileType: '',
|
||||
// fileUrl: ''
|
||||
// }
|
||||
],
|
||||
},
|
||||
workersList: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDict().then(() => {
|
||||
this.init();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取员工数据
|
||||
*/
|
||||
async getDict() {
|
||||
const workerRes = await getworkerAll();
|
||||
this.workersList = workerRes.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
async init() {
|
||||
this.initTop();
|
||||
this.initDown();
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化上部表单
|
||||
*/
|
||||
async initTop() {
|
||||
if (!this.logId) {
|
||||
this.$msgError('缺少报警日志id');
|
||||
this.$emit('close');
|
||||
}
|
||||
const url = '/base/equipment-alarm-log/get';
|
||||
const { data, code } = await this.$axios({
|
||||
url: url,
|
||||
method: 'get',
|
||||
params: {
|
||||
id: this.logId,
|
||||
},
|
||||
});
|
||||
if (code == 0) {
|
||||
this.orderForm = data;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化下部表单
|
||||
*/
|
||||
async initDown() {
|
||||
if (!this.logId) {
|
||||
this.$msgError('缺少报警日志id');
|
||||
this.$emit('close');
|
||||
}
|
||||
const url = '/base/equipment-alarm-hand/get';
|
||||
const { data, code } = await this.$axios({
|
||||
url: url,
|
||||
method: 'get',
|
||||
params: {
|
||||
id: this.logId,
|
||||
},
|
||||
});
|
||||
if (code == 0) {
|
||||
this.handleMethodForm = data;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新表单
|
||||
*/
|
||||
async submit() {
|
||||
const result = await Promise.all([
|
||||
await this.updateTop(),
|
||||
await this.updateHandleMethod(),
|
||||
]);
|
||||
if (result[0] == true && result[1] == true) {
|
||||
this.$modal.msgSuccess('更新成功');
|
||||
this.$emit('refreshDataList');
|
||||
} else {
|
||||
this.$modal.msgError('更新失败');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新下部表单
|
||||
*/
|
||||
async updateHandleMethod() {
|
||||
const url = '/base/equipment-alarm-hand';
|
||||
const valid = await this.$refs.orderForm.validate();
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
const { code, data } = await this.$axios({
|
||||
url: url + (this.handleMethodForm.id ? '/update' : '/create'),
|
||||
method: this.handleMethodForm.id ? 'put' : 'post',
|
||||
data: { ...this.handleMethodForm, logId: this.logId },
|
||||
});
|
||||
if (code == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新上部分表单
|
||||
*/
|
||||
async updateTop() {
|
||||
const url = '/base/equipment-alarm-log';
|
||||
const valid = await this.$refs.handleMethodForm.validate();
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
const { code, data } = await this.$axios({
|
||||
url: url + '/update',
|
||||
method: 'put',
|
||||
data: this.orderForm,
|
||||
});
|
||||
if (code == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.file) {
|
||||
const temp = this.file.split(','); // 获取文件个数
|
||||
let arry = [];
|
||||
temp.forEach((item) => {
|
||||
arry.push({
|
||||
fileType: 2,
|
||||
fileUrl: item,
|
||||
});
|
||||
});
|
||||
this.dataForm.files = arry;
|
||||
}
|
||||
this.urlOptions.createURL(this.dataForm).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.alarm-handle {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.alarm-handle__method >>> .el-select {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
@ -40,7 +40,7 @@ $pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
|
||||
$mgr: 8px;
|
||||
@each $size, $height in $pxls {
|
||||
.#{$size}-title {
|
||||
font-size: 18px;
|
||||
font-size: $height;
|
||||
line-height: $height;
|
||||
color: #000;
|
||||
font-weight: 500;
|
||||
@ -53,7 +53,7 @@ $mgr: 8px;
|
||||
width: 4px;
|
||||
height: $height + 2px;
|
||||
border-radius: 1px;
|
||||
margin-right: $mgr;
|
||||
margin-right: 4px;
|
||||
background-color: #0b58ff;
|
||||
}
|
||||
}
|
||||
|
@ -1,195 +0,0 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-11 20:33:12
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div>
|
||||
<small-title
|
||||
style="margin: 16px 0; padding-left: 8px"
|
||||
:no-padding="true">
|
||||
系统自带
|
||||
</small-title>
|
||||
<el-form
|
||||
:model="dataForm1"
|
||||
ref="dataForm1"
|
||||
label-width="80px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备编码" prop="equipment">
|
||||
<el-input
|
||||
v-model="dataForm1.equipment"
|
||||
disabled
|
||||
placeholder="请输入设备编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="报警时间" prop="createTime">
|
||||
<el-input
|
||||
v-model="dataForm1.createTime"
|
||||
disabled
|
||||
placeholder="请输入报警时间" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="报警编号" prop="code">
|
||||
<!-- 接口缺参数 -->
|
||||
<el-input
|
||||
v-model="dataForm1.code"
|
||||
disabled
|
||||
placeholder="请输入报警编号" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="报警内容" prop="alarmContent">
|
||||
<el-input
|
||||
v-model="dataForm1.alarmContent"
|
||||
disabled
|
||||
placeholder="请输入报警内容" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<small-title
|
||||
style="margin: 16px 0; padding-left: 8px"
|
||||
:no-padding="true">
|
||||
处理方式
|
||||
</small-title>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
label-width="80px">
|
||||
<el-form-item label="处理人" prop="hander">
|
||||
<el-select
|
||||
v-model="dataForm.hander"
|
||||
:disabled="isdetail"
|
||||
placeholder="请选择处理人"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in workersList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理方式" prop="handerMode">
|
||||
<editor v-model="dataForm.handerMode" :read-only="isdetail" :min-height="200"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="file">
|
||||
<!-- <el-input
|
||||
v-model="dataForm.file"
|
||||
type="textarea"
|
||||
min-size="3"
|
||||
placeholder="请输入处理方式" /> -->
|
||||
<FileUpload v-model="file" :disabled="isdetail" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import basicAdd from '../../../../core/mixins/basic-add';
|
||||
import SmallTitle from './SmallTitle';
|
||||
import { getworkerAll } from "@/api/base/materialUseLog";
|
||||
import { createAlarmHand, getAlarmLog } from '@/api/equipment/base/alarm/records';
|
||||
import FileUpload from "@/components/FileUpload";
|
||||
import Editor from "@/components/Editor";
|
||||
|
||||
export default {
|
||||
components: { SmallTitle, FileUpload, Editor },
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
createURL: createAlarmHand,
|
||||
infoURL: getAlarmLog,
|
||||
},
|
||||
dataForm1: {
|
||||
id: undefined,
|
||||
equipment: undefined,
|
||||
createTime: undefined,
|
||||
alarmContent: undefined,
|
||||
code: undefined
|
||||
},
|
||||
file: '',
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
hander: undefined,
|
||||
handerMode: undefined
|
||||
},
|
||||
isdetail: false,
|
||||
workersList: [],
|
||||
dataRule: {
|
||||
hander: [{ required: true, message: "处理人不能为空", trigger: "change" }],
|
||||
handerMode: [{ required: true, message: "处理方式不能为空", trigger: "blur" }]
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDict()
|
||||
console.log('我看看', this.dataForm)
|
||||
},
|
||||
methods: {
|
||||
async getDict() {
|
||||
// 获得员工
|
||||
const workerRes = await getworkerAll()
|
||||
this.workersList = workerRes.data
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs["dataForm"].validate((valid) => {
|
||||
if (!valid) {
|
||||
return false;
|
||||
}
|
||||
// 修改的提交
|
||||
// if (this.dataForm.id) {
|
||||
// this.urlOptions.updateURL(this.dataForm).then(response => {
|
||||
// this.$modal.msgSuccess("修改成功");
|
||||
// this.visible = false;
|
||||
// this.$emit("refreshDataList");
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
// 添加的提交
|
||||
if (this.file) {
|
||||
const temp = this.file.split(',') // 获取文件个数
|
||||
let arry = []
|
||||
temp.forEach(item => {
|
||||
arry.push({
|
||||
fileType: 2,
|
||||
fileUrl: item
|
||||
})
|
||||
})
|
||||
this.dataForm.files = arry
|
||||
}
|
||||
this.urlOptions.createURL(this.dataForm).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.visible = false;
|
||||
this.$emit("refreshDataList");
|
||||
});
|
||||
});
|
||||
},
|
||||
init(id, isdetail) {
|
||||
this.dataForm1.id = id || "";
|
||||
this.isdetail = isdetail || false
|
||||
this.visible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs["dataForm1"].resetFields();
|
||||
this.$refs["dataForm"].resetFields();
|
||||
if (this.dataForm1.id) {
|
||||
this.urlOptions.infoURL(id).then(response => {
|
||||
if (response.data) {
|
||||
this.dataForm1 = response.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
@ -45,20 +45,23 @@
|
||||
:disabled="mode == 'detail'"
|
||||
:has-files="false"
|
||||
:rows="rows" /> -->
|
||||
<add-or-update
|
||||
ref="addOrUpdate"
|
||||
@refreshDataList="successSubmit" />
|
||||
<AddOrUpdate
|
||||
v-if="open"
|
||||
ref="addOrUpdate"
|
||||
:read-only="readOnly"
|
||||
:log-id="chosedLogId"
|
||||
@close="cancel"
|
||||
@refreshDataList="successSubmit" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import AddOrUpdate from './add-or-updata.vue'
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
import AddOrUpdate from './AddOrUpdate.vue';
|
||||
import moment from 'moment';
|
||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
const btn = {
|
||||
name: 'tableBtn',
|
||||
@ -68,7 +71,10 @@ const btn = {
|
||||
},
|
||||
methods: {
|
||||
handleClick() {
|
||||
this.$emit('emitData', { action: this.injectData.name, value: this.injectData });
|
||||
this.$emit('emitData', {
|
||||
action: this.injectData.name,
|
||||
value: this.injectData,
|
||||
});
|
||||
},
|
||||
},
|
||||
render: function (h) {
|
||||
@ -80,14 +86,14 @@ const btn = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Record',
|
||||
components: { AddOrUpdate },
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
readOnly: false,
|
||||
chosedLogId: false,
|
||||
searchBarKeys: ['equipmentName', 'recordTime'],
|
||||
tableBtn: [
|
||||
// this.$auth.hasPermi('equipment:spare-parts-config:update')
|
||||
@ -113,12 +119,16 @@ export default {
|
||||
{ prop: 'productionLine', label: '产线' },
|
||||
{ prop: 'workshopSection', label: '工段' },
|
||||
{ prop: 'equipment', label: '设备名称' },
|
||||
{ prop: 'alarmGrade', label: '报警级别', filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL) },
|
||||
{ prop: 'responsible', label: '报警时间' }, // 接口缺
|
||||
{ prop: 'responsible1', label: '设备报警码' }, // 接口缺
|
||||
{
|
||||
prop: 'alarmGrade',
|
||||
label: '报警级别',
|
||||
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
|
||||
},
|
||||
{ prop: 'createTime', label: '报警时间', filter: timeFilter }, // 接口缺
|
||||
{ prop: 'alarmCode', label: '设备报警码' }, // 接口缺
|
||||
{ prop: 'alarmContent', label: '报警内容' },
|
||||
{ prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn },
|
||||
{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn }, // TODO: 是否换成按钮, 群里问
|
||||
{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn }, // TODO: 是否换成按钮, 群里问
|
||||
// { prop: 'remark', label: '备注' },
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
@ -135,8 +145,8 @@ export default {
|
||||
dateType: 'daterange', // datetimerange
|
||||
// format: 'yyyy-MM-dd HH:mm:ss',
|
||||
format: 'yyyy-MM-dd',
|
||||
// valueFormat: 'timestamp',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
valueFormat: 'timestamp',
|
||||
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期',
|
||||
@ -196,9 +206,10 @@ export default {
|
||||
pageSize: 10,
|
||||
lineId: null,
|
||||
equipmentId: null,
|
||||
recordTime: []
|
||||
},
|
||||
basePath: '/base/equipment-alarm-log',
|
||||
list: []
|
||||
list: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -206,21 +217,20 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleEmitFun(val) {
|
||||
console.log('你好', val)
|
||||
if (val.action === '报警处理') {
|
||||
// this.chosedLogId = val.value.alarmId;
|
||||
this.chosedLogId = val.value.id;
|
||||
// 报警处理
|
||||
this.open = true
|
||||
this.title = '报警处理'
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(val.value.id);
|
||||
});
|
||||
this.open = true;
|
||||
this.title = '报警处理';
|
||||
this.readOnly = false;
|
||||
} else {
|
||||
// this.chosedLogId = val.value.alarmId;
|
||||
this.chosedLogId = val.value.id;
|
||||
// 查看
|
||||
this.open = true
|
||||
this.title = '查看'
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(val.value.id, true);
|
||||
});
|
||||
this.open = true;
|
||||
this.title = '查看';
|
||||
this.readOnly = true;
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
@ -234,9 +244,9 @@ export default {
|
||||
});
|
||||
},
|
||||
successSubmit() {
|
||||
this.cancel()
|
||||
this.getList()
|
||||
},
|
||||
this.cancel();
|
||||
this.getList();
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
@ -282,7 +292,7 @@ export default {
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs.addOrUpdate.dataFormSubmit()
|
||||
this.$refs.addOrUpdate.submit();
|
||||
// this.$refs['form'].validate((valid) => {
|
||||
// if (!valid) {
|
||||
// return;
|
||||
|
@ -12,7 +12,7 @@
|
||||
:wrapper-closable="false"
|
||||
class="drawer"
|
||||
custom-class="mes-drawer"
|
||||
size="60%"
|
||||
:size="size || '50%'"
|
||||
@closed="$emit('destroy')">
|
||||
<SmallTitle slot="title">
|
||||
{{
|
||||
@ -42,7 +42,8 @@
|
||||
:dataForm="form"
|
||||
:rows="formRows" /> -->
|
||||
|
||||
<el-row style="margin-bottom: 24px">
|
||||
<!-- if -->
|
||||
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
|
||||
<el-col :span="8">
|
||||
<div
|
||||
class="title"
|
||||
@ -62,13 +63,39 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- else -->
|
||||
<el-row v-else style="margin-bottom: 24px" :gutter="20">
|
||||
<el-form ref="form" :model="form">
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
class="title"
|
||||
label="设备分组名称"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
placeholder="请输入设备分组名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
class="title"
|
||||
label="设备分组编码"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
placeholder="请输入设备分组编码"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="section.key == 'attrs'"
|
||||
style="position: relative; margin-top: 12px">
|
||||
<!-- v-if="!mode.includes('detail')" -->
|
||||
<div style="position: absolute; top: -40px; right: 0">
|
||||
<div
|
||||
v-if="!mode.includes('detail')"
|
||||
style="position: absolute; top: -40px; right: 0">
|
||||
<el-button @click="handleAddAttr" type="text">
|
||||
<i class="el-icon-plus"></i>
|
||||
添加报警
|
||||
@ -84,7 +111,7 @@
|
||||
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
|
||||
@emitButtonClick="handleAddAttr" -->
|
||||
<method-btn
|
||||
v-if="section.tableBtn"
|
||||
v-if="section.tableBtn && !mode.includes('detail')"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@ -103,11 +130,13 @@
|
||||
</div>
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" @click="handleCancel">取消</el-button>
|
||||
<!-- <el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
|
||||
编辑
|
||||
</el-button> -->
|
||||
<!-- <el-button v-else type="primary" @click="handleCancel">确定</el-button> -->
|
||||
<el-button style="" @click="handleCancel">返回</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="!mode.includes('detail')"
|
||||
@click="handleSave">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -163,7 +192,7 @@ const SmallTitle = {
|
||||
|
||||
export default {
|
||||
components: { SmallTitle, DialogForm, BaseInfoForm },
|
||||
props: ['sections', 'defaultMode', 'dataId'], // dataId 作为一个通用的存放id的字段
|
||||
props: ['sections', 'defaultMode', 'dataId', 'size'], // dataId 作为一个通用的存放id的字段
|
||||
data() {
|
||||
return {
|
||||
mode: '',
|
||||
@ -191,7 +220,9 @@ export default {
|
||||
label: '报警编码', // 自动生成
|
||||
prop: 'code',
|
||||
url: '/base/equipment-group-alarm/getCode',
|
||||
rules: [{ required: true, message: '报警编码不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警编码不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
@ -205,13 +236,17 @@ export default {
|
||||
input: true,
|
||||
label: '参数列名', // 在实时数据库的列名
|
||||
prop: 'plcParamName',
|
||||
rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '报警内容',
|
||||
prop: 'alarmContent',
|
||||
rules: [{ required: true, message: '报警内容不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警内容不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@ -223,7 +258,9 @@ export default {
|
||||
{ label: '布尔型', value: 2 },
|
||||
{ label: '字符型', value: 1 },
|
||||
],
|
||||
rules: [{ required: true, message: '报警类型不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警类型不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
@ -322,7 +359,7 @@ export default {
|
||||
handleSave() {
|
||||
this.$refs['form'][0].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.mode == 'edit';
|
||||
const isEdit = !this.mode.includes('detail');
|
||||
await this.$axios({
|
||||
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
|
||||
method: isEdit ? 'put' : 'post',
|
||||
@ -403,32 +440,32 @@ export default {
|
||||
},
|
||||
|
||||
// 提交属性表
|
||||
async submitAttrForm() {
|
||||
this.$refs['attrForm'].validate((valid) => {
|
||||
submitAttrForm() {
|
||||
this.$refs['attrForm'].validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
const isEdit = this.attrForm.id != null;
|
||||
this.attrFormSubmitting = true;
|
||||
const res = await this.$axios({
|
||||
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
|
||||
method: isEdit ? 'put' : 'post',
|
||||
data: this.attrForm,
|
||||
});
|
||||
|
||||
if (res.code == 0) {
|
||||
this.closeAttrForm();
|
||||
this.$message({
|
||||
message: `${isEdit ? '更新' : '创建'}成功`,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getAttrList();
|
||||
},
|
||||
const isEdit = this.attrForm.id != null;
|
||||
this.attrFormSubmitting = true;
|
||||
const res = await this.$axios({
|
||||
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
|
||||
method: isEdit ? 'put' : 'post',
|
||||
data: this.attrForm,
|
||||
});
|
||||
}
|
||||
this.attrFormSubmitting = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
this.closeAttrForm();
|
||||
this.$message({
|
||||
message: `${isEdit ? '更新' : '创建'}成功`,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getAttrList();
|
||||
},
|
||||
});
|
||||
}
|
||||
this.attrFormSubmitting = false;
|
||||
});
|
||||
},
|
||||
|
||||
closeAttrForm() {
|
||||
|
@ -45,6 +45,7 @@
|
||||
<BasicDrawer
|
||||
v-if="editVisible"
|
||||
ref="drawer"
|
||||
size="45%"
|
||||
:default-mode="editMode"
|
||||
:data-id="alarmForm.id"
|
||||
:sections="[
|
||||
@ -403,12 +404,25 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
handleTableBtnClick({ data, type }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
this.handleDetail(data, 'edit');
|
||||
break;
|
||||
case 'delete':
|
||||
this.handleDelete(data);
|
||||
break;
|
||||
case 'detail':
|
||||
this.handleDetail(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 查看报警
|
||||
handleDetail(row) {
|
||||
handleDetail(row, mode = 'detail') {
|
||||
// debugger;
|
||||
const { id, code, name, createTime } = row;
|
||||
// 打开抽屉
|
||||
this.editMode = 'detail';
|
||||
this.editMode = mode;
|
||||
this.alarmForm.id = id;
|
||||
this.alarmForm.equipmentGroupCode = code;
|
||||
this.alarmForm.equipmentGroupName = name;
|
||||
|
@ -12,7 +12,7 @@
|
||||
:wrapper-closable="false"
|
||||
class="drawer"
|
||||
custom-class="mes-drawer"
|
||||
size="60%"
|
||||
:size="size || '50%'"
|
||||
@closed="$emit('destroy')">
|
||||
<SmallTitle slot="title">
|
||||
{{
|
||||
@ -42,7 +42,7 @@
|
||||
:dataForm="form"
|
||||
:rows="formRows" /> -->
|
||||
|
||||
<el-row style="margin-bottom: 24px">
|
||||
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
|
||||
<el-col :span="8">
|
||||
<div
|
||||
class="title"
|
||||
@ -62,13 +62,38 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-else style="margin-bottom: 24px" :gutter="20">
|
||||
<el-form ref="form" :model="form">
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
class="title"
|
||||
label="设备分组名称"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
placeholder="请输入设备分组名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
class="title"
|
||||
label="设备分组编码"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
placeholder="请输入设备分组编码"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="section.key == 'attrs'"
|
||||
style="position: relative; margin-top: 12px">
|
||||
<!-- v-if="!mode.includes('detail')" -->
|
||||
<div style="position: absolute; top: -40px; right: 0">
|
||||
<div
|
||||
v-if="!mode.includes('detail')"
|
||||
style="position: absolute; top: -40px; right: 0">
|
||||
<el-button @click="handleAddAttr" type="text">
|
||||
<i class="el-icon-plus"></i>
|
||||
添加属性
|
||||
@ -84,7 +109,7 @@
|
||||
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
|
||||
@emitButtonClick="handleAddAttr" -->
|
||||
<method-btn
|
||||
v-if="section.tableBtn"
|
||||
v-if="section.tableBtn && !mode.includes('detail')"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@ -104,10 +129,12 @@
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" @click="handleCancel">取消</el-button>
|
||||
<!-- <el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
|
||||
编辑
|
||||
</el-button> -->
|
||||
<!-- <el-button v-else type="primary" @click="handleCancel">确定</el-button> -->
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="!mode.includes('detail')"
|
||||
@click="handleSave">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -163,7 +190,7 @@ const SmallTitle = {
|
||||
|
||||
export default {
|
||||
components: { SmallTitle, DialogForm, BaseInfoForm },
|
||||
props: ['sections', 'defaultMode', 'dataId'], // dataId 作为一个通用的存放id的字段
|
||||
props: ['sections', 'defaultMode', 'dataId', 'size'], // dataId 作为一个通用的存放id的字段
|
||||
data() {
|
||||
return {
|
||||
mode: '',
|
||||
@ -191,7 +218,9 @@ export default {
|
||||
label: '报警编码', // 自动生成
|
||||
prop: 'code',
|
||||
url: '/base/equipment-group-alarm/getCode',
|
||||
rules: [{ required: true, message: '报警编码不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警编码不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
select: true,
|
||||
@ -201,7 +230,9 @@ export default {
|
||||
{ label: '布尔型', value: 2 },
|
||||
{ label: '字符型', value: 1 },
|
||||
],
|
||||
rules: [{ required: true, message: '报警类型不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警类型不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@ -222,13 +253,17 @@ export default {
|
||||
input: true,
|
||||
label: '参数列名', // 在实时数据库的列名
|
||||
prop: 'plcParamName',
|
||||
rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '报警内容',
|
||||
prop: 'alarmContent',
|
||||
rules: [{ required: true, message: '报警内容不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警内容不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
],
|
||||
@ -322,7 +357,7 @@ export default {
|
||||
handleSave() {
|
||||
this.$refs['form'][0].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.mode == 'edit';
|
||||
const isEdit = !this.mode.includes('detail');
|
||||
await this.$axios({
|
||||
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
|
||||
method: isEdit ? 'put' : 'post',
|
||||
@ -403,33 +438,32 @@ export default {
|
||||
},
|
||||
|
||||
// 提交属性表
|
||||
async submitAttrForm() {
|
||||
this.$refs['attrForm'].validate((valid) => {
|
||||
submitAttrForm() {
|
||||
this.$refs['attrForm'].validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
console.log('this.attrform', this.attrForm);
|
||||
const isEdit = this.attrForm.id != null;
|
||||
this.attrFormSubmitting = true;
|
||||
const res = await this.$axios({
|
||||
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
|
||||
method: isEdit ? 'put' : 'post',
|
||||
data: this.attrForm,
|
||||
});
|
||||
|
||||
if (res.code == 0) {
|
||||
this.closeAttrForm();
|
||||
this.$message({
|
||||
message: `${isEdit ? '更新' : '创建'}成功`,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getAttrList();
|
||||
},
|
||||
const isEdit = this.attrForm.id != null;
|
||||
this.attrFormSubmitting = true;
|
||||
const res = await this.$axios({
|
||||
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
|
||||
method: isEdit ? 'put' : 'post',
|
||||
data: this.attrForm,
|
||||
});
|
||||
}
|
||||
this.attrFormSubmitting = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
this.closeAttrForm();
|
||||
this.$message({
|
||||
message: `${isEdit ? '更新' : '创建'}成功`,
|
||||
type: 'success',
|
||||
duration: 1500,
|
||||
onClose: () => {
|
||||
this.getAttrList();
|
||||
},
|
||||
});
|
||||
}
|
||||
this.attrFormSubmitting = false;
|
||||
});
|
||||
},
|
||||
|
||||
closeAttrForm() {
|
||||
|
@ -45,6 +45,7 @@
|
||||
<BasicDrawer
|
||||
v-if="editVisible"
|
||||
ref="drawer"
|
||||
size="45%"
|
||||
:default-mode="editMode"
|
||||
:data-id="alarmForm.id"
|
||||
:sections="[
|
||||
@ -224,7 +225,9 @@ export default {
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
rules: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '设备不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@ -238,7 +241,9 @@ export default {
|
||||
bind: {
|
||||
filterable: true,
|
||||
},
|
||||
rules: [{ required: true, message: '报警分组不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警分组不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
],
|
||||
@ -269,7 +274,13 @@ export default {
|
||||
input: true,
|
||||
label: '设备分组名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '设备分组名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '设备分组名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
// bind: {
|
||||
// disabled: this.editMode == 'detail', // some condition, like detail mode...
|
||||
// }
|
||||
@ -287,26 +298,23 @@ export default {
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
fixed: true,
|
||||
width: 180,
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
},
|
||||
{ width: 240, prop: 'code', label: '报警编码' },
|
||||
{ prop: 'code', label: '报警编码' },
|
||||
{
|
||||
width: 100,
|
||||
prop: 'type',
|
||||
label: '报警类型',
|
||||
filter: (val) =>
|
||||
val != null ? ['-', '字符型', '布尔型', '-'][val] : '-',
|
||||
},
|
||||
{
|
||||
width: 90,
|
||||
prop: 'grade',
|
||||
label: '报警级别',
|
||||
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
|
||||
},
|
||||
{ width: 180, prop: 'alarmCode', label: '设备报警编码' },
|
||||
{ width: 128, prop: 'plcParamName', label: '参数列名' },
|
||||
{ width: 128, prop: 'alarmContent', label: '报警内容' },
|
||||
{ prop: 'alarmCode', label: '设备报警编码' },
|
||||
{ prop: 'plcParamName', label: '参数列名' },
|
||||
{ prop: 'alarmContent', label: '报警内容' },
|
||||
],
|
||||
};
|
||||
},
|
||||
@ -361,6 +369,19 @@ export default {
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
handleTableBtnClick({ data, type }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
this.handleDetail(data, 'edit');
|
||||
break;
|
||||
case 'delete':
|
||||
this.handleDelete(data);
|
||||
break;
|
||||
case 'detail':
|
||||
this.handleDetail(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
@ -411,11 +432,11 @@ export default {
|
||||
});
|
||||
},
|
||||
// 查看报警
|
||||
handleDetail(row) {
|
||||
handleDetail(row, mode = 'detail') {
|
||||
const { equipmentId, equipmentName, groupCode, groupId, groupName, id } =
|
||||
row;
|
||||
// 打开抽屉
|
||||
this.editMode = 'detail';
|
||||
this.editMode = mode;
|
||||
this.alarmForm.id = groupId;
|
||||
this.alarmForm.equipmentGroupCode = groupCode;
|
||||
this.alarmForm.equipmentGroupName = groupName;
|
||||
|
@ -52,6 +52,7 @@
|
||||
<BasicDrawer
|
||||
v-if="editVisible"
|
||||
ref="drawer"
|
||||
size="45%"
|
||||
:default-mode="editMode"
|
||||
:info-data="alarmForm"
|
||||
:sections="[
|
||||
@ -59,6 +60,10 @@
|
||||
name: '基本信息',
|
||||
key: 'base',
|
||||
rows: drawerBaseInfoRows,
|
||||
url: '/base/equipment-plc-connect/get',
|
||||
urlUpdate: '/base/equipment-plc-connect/update',
|
||||
urlCreate: '/base/equipment-plc-connect/create',
|
||||
queryParams: { id: alarmForm.id },
|
||||
},
|
||||
{
|
||||
name: '采集参数',
|
||||
@ -189,7 +194,7 @@ export default {
|
||||
placeholder: '请选择设备',
|
||||
param: 'equipmentId',
|
||||
selectOptions: [],
|
||||
filterable: true
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
@ -197,7 +202,7 @@ export default {
|
||||
placeholder: '请选择关联表编码',
|
||||
param: 'plcId',
|
||||
selectOptions: [],
|
||||
filterable: true
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@ -311,8 +316,8 @@ export default {
|
||||
label: '生产参数类型',
|
||||
filter: (val) =>
|
||||
val != null
|
||||
// ? ['', '进片数量', '出片数量', '破损数量', '无类型', ''][val]
|
||||
? ['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
|
||||
? // ? ['', '进片数量', '出片数量', '破损数量', '无类型', ''][val]
|
||||
['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
|
||||
: '-',
|
||||
},
|
||||
{
|
||||
@ -423,6 +428,19 @@ export default {
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
handleTableBtnClick({ data, type }) {
|
||||
switch (type) {
|
||||
case 'edit':
|
||||
this.handleDetail(data, 'edit');
|
||||
break;
|
||||
case 'delete':
|
||||
this.handleDelete(data);
|
||||
break;
|
||||
case 'detail':
|
||||
this.handleDetail(data);
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
@ -474,7 +492,7 @@ export default {
|
||||
},
|
||||
|
||||
// 查看报警
|
||||
handleDetail(row) {
|
||||
handleDetail(row, mode = 'detail') {
|
||||
// debugger;
|
||||
const {
|
||||
id,
|
||||
@ -490,7 +508,7 @@ export default {
|
||||
workshopSection,
|
||||
} = row;
|
||||
// 打开抽屉
|
||||
this.editMode = 'detail';
|
||||
this.editMode = mode;
|
||||
this.alarmForm.id = id;
|
||||
this.alarmForm.plcTableName = plcTableName; // 关联表名
|
||||
this.alarmForm.equipmentName = equipmentName;
|
||||
|
@ -12,7 +12,7 @@
|
||||
:wrapper-closable="false"
|
||||
class="drawer"
|
||||
custom-class="mes-drawer"
|
||||
size="60%"
|
||||
:size="size || '50%'"
|
||||
@closed="$emit('destroy')">
|
||||
<SmallTitle slot="title">
|
||||
{{
|
||||
@ -42,7 +42,8 @@
|
||||
v-model="form"
|
||||
:rows="formRows" /> -->
|
||||
|
||||
<el-row style="margin-bottom: 24px">
|
||||
<!-- if -->
|
||||
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
|
||||
<el-col :span="8">
|
||||
<div
|
||||
class="title"
|
||||
@ -64,13 +65,39 @@
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<!-- else -->
|
||||
<el-row v-else style="margin-bottom: 24px" :gutter="20">
|
||||
<el-form ref="form" :model="form">
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
class="title"
|
||||
label="设备名"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.equipmentName"
|
||||
placeholder="请输入设备名"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
class="title"
|
||||
label="设备关联表名"
|
||||
style="font-size: 16px; margin: 8px 0">
|
||||
<el-input
|
||||
v-model="form.plcTableName"
|
||||
placeholder="请输入关联表名"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="section.key == 'attrs'"
|
||||
style="position: relative; margin-top: 12px">
|
||||
<!-- v-if="!mode.includes('detail')" -->
|
||||
<div style="position: absolute; top: -40px; right: 0">
|
||||
<div
|
||||
v-if="!mode.includes('detail')"
|
||||
style="position: absolute; top: -40px; right: 0">
|
||||
<el-button @click="handleAddAttr" type="text">
|
||||
<i class="el-icon-plus"></i>
|
||||
添加属性
|
||||
@ -86,7 +113,7 @@
|
||||
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
|
||||
@emitButtonClick="handleAddAttr" -->
|
||||
<method-btn
|
||||
v-if="section.tableBtn"
|
||||
v-if="section.tableBtn && !mode.includes('detail')"
|
||||
slot="handleBtn"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@ -106,10 +133,12 @@
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" @click="handleCancel">取消</el-button>
|
||||
<!-- <el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
|
||||
编辑
|
||||
</el-button> -->
|
||||
<!-- <el-button v-else type="primary" @click="handleCancel">确定</el-button> -->
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="!mode.includes('detail')"
|
||||
@click="handleSave">
|
||||
保存
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -164,7 +193,7 @@ const SmallTitle = {
|
||||
|
||||
export default {
|
||||
components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm },
|
||||
props: ['sections', 'defaultMode', 'infoData'],
|
||||
props: ['sections', 'defaultMode', 'infoData', 'size'],
|
||||
data() {
|
||||
return {
|
||||
mode: '',
|
||||
@ -412,7 +441,7 @@ export default {
|
||||
handleSave() {
|
||||
this.$refs['form'][0].validate(async (valid) => {
|
||||
if (valid) {
|
||||
const isEdit = this.mode == 'edit';
|
||||
const isEdit = !this.mode.includes('detail');
|
||||
await this.$axios({
|
||||
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
|
||||
method: isEdit ? 'put' : 'post',
|
||||
|
@ -105,7 +105,12 @@ export default {
|
||||
}
|
||||
this.listEq.splice(0);
|
||||
},
|
||||
handleSearch() {},
|
||||
handleSearch() {
|
||||
this.$emit('action', {
|
||||
action: 'search',
|
||||
payload: this.form,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<SearchBarNew v-model="searchBarForm" />
|
||||
<SearchBarNew v-model="searchBarForm" @action="handleSearchBarActions" />
|
||||
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
@ -128,13 +128,31 @@ export default {
|
||||
list: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
handleEmitFun(val) {
|
||||
console.log('你好', val);
|
||||
if (val.action === '状态可视化') {
|
||||
/**
|
||||
* 处理表格按钮点击事件
|
||||
* @param {string} action 按钮名称
|
||||
* @param {object} value 按钮数据(行数据) { equipmentId, equipmentCode, equipmentName, inQuantity, outQuantity, run, status, error, quantityRecordTime, statusRecordTime}
|
||||
*/
|
||||
handleEmitFun({ action, value: row } = {}) {
|
||||
if (action === '状态可视化') {
|
||||
// 状态可视化
|
||||
} else {
|
||||
} else if (action === '参数监控') {
|
||||
// 参数监控
|
||||
// 接口需要 equipmentId recordTime workOrderId 工单id
|
||||
this.$router.push({
|
||||
// path: '/equipment/monitor/full-params',
|
||||
name: 'EquipmentFullParams',
|
||||
params: {
|
||||
equipmentId: row.equipmentId,
|
||||
equipmentCode: row.equipmentCode,
|
||||
equipmentName: row.equipmentName,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
}
|
||||
},
|
||||
/** 查询列表 */
|
||||
@ -172,9 +190,25 @@ export default {
|
||||
// };
|
||||
// this.resetForm('form');
|
||||
// },
|
||||
handleSearchBarActions({ action, payload }) {
|
||||
switch (action) {
|
||||
case 'search':
|
||||
this.handleQuery();
|
||||
break;
|
||||
case 'reset':
|
||||
this.resetQuery();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.queryParams = {
|
||||
...this.queryParams,
|
||||
...this.searchBarForm,
|
||||
pageNo: 1,
|
||||
};
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
|
@ -35,12 +35,12 @@
|
||||
" />
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-data-bg">
|
||||
</div>
|
||||
<div v-else class="no-data-bg"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Message } from 'element-ui';
|
||||
import LocalDataManager from './utils/local-data-manager';
|
||||
// import response from './response';
|
||||
import moment from 'moment';
|
||||
@ -55,7 +55,6 @@ export default {
|
||||
const today = new Date(y, m, d, 0, 0, 0, 0).getTime();
|
||||
const aWeekAgo = today - 3600 * 1000 * 24 * 7;
|
||||
return {
|
||||
tableList: [],
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
@ -109,35 +108,67 @@ export default {
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
id() {
|
||||
return this.$route.params.equipmentId;
|
||||
},
|
||||
code() {
|
||||
return this.$route.params.equipmentCode;
|
||||
},
|
||||
name() {
|
||||
return this.$route.params.equipmentName;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.id) this.$set(this.queryParams, 'id', this.id);
|
||||
if (this.code)
|
||||
this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code);
|
||||
if (this.name)
|
||||
this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name);
|
||||
beforeRouteEnter(to, from, next) {
|
||||
if (Object.keys(to.params).length > 0) {
|
||||
next((vm) => {
|
||||
vm.$set(vm.queryParams, 'id', to.params.equipmentId);
|
||||
vm.$set(
|
||||
vm.searchBarFormConfig[0],
|
||||
'defaultSelect',
|
||||
to.params.equipmentCode
|
||||
);
|
||||
vm.$set(
|
||||
vm.searchBarFormConfig[1],
|
||||
'defaultSelect',
|
||||
to.params.equipmentName
|
||||
);
|
||||
vm.handleQuery();
|
||||
});
|
||||
} else {
|
||||
// let timeleft = 3;
|
||||
|
||||
// this.handleResponse();
|
||||
// const message = Message({
|
||||
// type: 'warning',
|
||||
// duration: 0,
|
||||
// message: `请先选择设备, 即将引导进入设备状态和参数页面, 剩余 ${timeleft} s`,
|
||||
// });
|
||||
|
||||
// const timer = setInterval(() => {
|
||||
// if (timeleft > 0) {
|
||||
// timeleft--;
|
||||
// message.$data.message = `请先选择设备, 即将引导进入设备状态和参数页面, 剩余 ${timeleft} s`
|
||||
// return;
|
||||
// }
|
||||
// message.close();
|
||||
// clearInterval(timer);
|
||||
// timer = null;
|
||||
// }, 1000);
|
||||
|
||||
// next({ name: 'EquipmentStatusAndParams' });
|
||||
next((vm) => {
|
||||
vm.$message({
|
||||
type: 'error',
|
||||
message: `请先选择设备`,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
// clean job
|
||||
this.$set(this.queryParams, 'id', null);
|
||||
this.$set(this.searchBarFormConfig[0], 'defaultSelect', null);
|
||||
this.$set(this.searchBarFormConfig[1], 'defaultSelect', null);
|
||||
this.tableList = [];
|
||||
next();
|
||||
},
|
||||
methods: {
|
||||
buildProps(table) {
|
||||
console.log('building props', table);
|
||||
// 通过 otherList 来构建 props
|
||||
const { otherList } = table;
|
||||
const props = [
|
||||
{
|
||||
// type: 'index',
|
||||
width: 48,
|
||||
width: 56,
|
||||
prop: 'index',
|
||||
label: '序号',
|
||||
},
|
||||
@ -147,7 +178,7 @@ export default {
|
||||
label: '时间',
|
||||
},
|
||||
{
|
||||
width: 200,
|
||||
width: 240,
|
||||
prop: 'plcCode',
|
||||
label: 'PLC编码',
|
||||
},
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user