Compare commits

..

No commits in common. "b86094c6307c6ade065e0e24dd44c2a92a9533f5" and "b3a117f6c647f89ea50b76ccb3a95a800513d4a5" have entirely different histories.

30 changed files with 463 additions and 822 deletions

View File

@ -144,8 +144,8 @@ export default {
getDataList() { getDataList() {
this.dataListLoading = true; this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => { this.urlOptions.getDataListURL(this.listQuery).then(response => {
// this.tableData = response.data.list; this.tableData = response.data.list;
this.getStatus(response.data.list) // this.getStatus(response.data.list)
this.listQuery.total = response.data.total; this.listQuery.total = response.data.total;
this.dataListLoading = false; this.dataListLoading = false;
}); });

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-24 18:20:26 * @LastEditTime: 2023-11-20 16:51:24
* @Description: * @Description:
--> -->
<template> <template>
@ -29,10 +29,11 @@
<div class="action_btn"> <div class="action_btn">
<template> <template>
<span style="display: inline-block;"> <span style="display: inline-block;" @click="addNew()">
<el-button type="text" @click="addNew()" icon="el-icon-plus">添加</el-button> <svg-icon style="width: 14px; height: 14px" class="item-icon" icon-class="table_add" />
</span> <span class="add">添加</span>
</template> </span>
</template>
</div> </div>
<base-table <base-table
:table-props="tableProps" :table-props="tableProps"
@ -297,7 +298,7 @@ export default {
} }
.action_btn { .action_btn {
float: right; float: right;
margin: -40px 15px; margin: 5px 15px;
font-size: 14px; font-size: 14px;
} }
.add { .add {

View File

@ -311,11 +311,11 @@ export default {
if (val) { if (val) {
this.productList.map(item => { this.productList.map(item => {
if (val === item.id) { if (val === item.id) {
this.dataForm.specifications = item.specifications this.dataForm.productSpec = item.specifications
} }
}) })
} else { } else {
this.dataForm.specifications = '' this.dataForm.productSpec = ''
} }
} }
} }

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-24 18:13:02 * @LastEditTime: 2023-11-22 10:26:58
* @Description: * @Description:
--> -->
<template> <template>
@ -196,7 +196,7 @@ export default {
workCost: undefined, workCost: undefined,
remark: undefined, remark: undefined,
}, },
majorIdList: [], majorIdList: undefined,
departmentlList: [], departmentlList: [],
menuOptions: [], menuOptions: [],
bindIds: [], bindIds: [],
@ -267,7 +267,7 @@ export default {
workCost: undefined, workCost: undefined,
remark: undefined remark: undefined
} }
this.majorIdList = [] this.majorIdList = undefined
}, },
// //
dataFormSubmit() { dataFormSubmit() {
@ -288,28 +288,24 @@ export default {
this.visible = false; this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");
}); });
if (this.majorIdList.length > 0) { this.majorIdList.forEach(majorId => {
this.majorIdList.forEach(majorId => { createWoBindMa({
createWoBindMa({ workerId: this.dataForm.id,
workerId: this.dataForm.id, majorId: majorId
majorId: majorId }).then(res => {})
}).then(res => {}) });
});
}
return; return;
} }
// //
this.urlOptions.createURL(this.dataForm).then(response => { this.urlOptions.createURL(this.dataForm).then(response => {
// response.data = id // response.data = id
this.workerId = response.data this.workerId = response.data
if (this.majorIdList.length > 0) { this.majorIdList.forEach(majorId => {
this.majorIdList.forEach(majorId => { createWoBindMa({
createWoBindMa({ workerId: this.workerId,
workerId: this.workerId, majorId: majorId
majorId: majorId }).then(res => {})
}).then(res => {}) });
});
}
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.visible = false; this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");
@ -328,7 +324,6 @@ export default {
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => { this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data; this.dataForm = response.data;
this.dataForm.departmentName = undefined
}); });
// -- // --
getWoBindMaPage({ getWoBindMaPage({

View File

@ -166,17 +166,13 @@ export default {
input: true, input: true,
label: '参数列名', label: '参数列名',
prop: 'plcParamName', prop: 'plcParamName',
rules: [ rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
],
}, },
{ {
input: true, input: true,
label: '参数名称', label: '参数名称',
prop: 'name', prop: 'name',
rules: [ rules: [{ required: true, message: '参数名称不能为空', trigger: 'blur' }],
{ required: true, message: '参数名称不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -423,35 +419,35 @@ export default {
}, },
// //
submitAttrForm() { async submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => { this.$refs['attrForm'].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
} }
const isEdit = this.attrForm.id != null; });
this.attrFormSubmitting = true; const isEdit = this.attrForm.id != null;
const res = await this.$axios({ this.attrFormSubmitting = true;
url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate, const res = await this.$axios({
method: isEdit ? 'put' : 'post', url: isEdit ? this.sections[1].urlUpdate : this.sections[1].urlCreate,
data: { method: isEdit ? 'put' : 'post',
...this.attrForm, data: {
connectId: this.infoData.id, ...this.attrForm,
connectId: this.infoData.id
},
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
}, },
}); });
}
if (res.code == 0) { this.attrFormSubmitting = false;
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
});
}, },
closeAttrForm() { closeAttrForm() {

View File

@ -1,281 +0,0 @@
<!--
* @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>

View File

@ -40,7 +40,7 @@ $pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px; $mgr: 8px;
@each $size, $height in $pxls { @each $size, $height in $pxls {
.#{$size}-title { .#{$size}-title {
font-size: $height; font-size: 18px;
line-height: $height; line-height: $height;
color: #000; color: #000;
font-weight: 500; font-weight: 500;
@ -53,7 +53,7 @@ $mgr: 8px;
width: 4px; width: 4px;
height: $height + 2px; height: $height + 2px;
border-radius: 1px; border-radius: 1px;
margin-right: 4px; margin-right: $mgr;
background-color: #0b58ff; background-color: #0b58ff;
} }
} }

View File

@ -0,0 +1,195 @@
<!--
* @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>

View File

@ -45,23 +45,20 @@
:disabled="mode == 'detail'" :disabled="mode == 'detail'"
:has-files="false" :has-files="false"
:rows="rows" /> --> :rows="rows" /> -->
<AddOrUpdate <add-or-update
v-if="open" ref="addOrUpdate"
ref="addOrUpdate" @refreshDataList="successSubmit" />
:read-only="readOnly"
:log-id="chosedLogId"
@close="cancel"
@refreshDataList="successSubmit" />
</base-dialog> </base-dialog>
</div> </div>
</template> </template>
<script> <script>
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { publicFormatter } from '@/utils/dict';
import AddOrUpdate from './AddOrUpdate.vue';
import moment from 'moment'; import moment from 'moment';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); 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');
const btn = { const btn = {
name: 'tableBtn', name: 'tableBtn',
@ -71,10 +68,7 @@ const btn = {
}, },
methods: { methods: {
handleClick() { handleClick() {
this.$emit('emitData', { this.$emit('emitData', { action: this.injectData.name, value: this.injectData });
action: this.injectData.name,
value: this.injectData,
});
}, },
}, },
render: function (h) { render: function (h) {
@ -86,14 +80,14 @@ const btn = {
}, },
}; };
export default { export default {
name: 'Record', name: 'Record',
components: { AddOrUpdate }, components: { AddOrUpdate },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
readOnly: false,
chosedLogId: false,
searchBarKeys: ['equipmentName', 'recordTime'], searchBarKeys: ['equipmentName', 'recordTime'],
tableBtn: [ tableBtn: [
// this.$auth.hasPermi('equipment:spare-parts-config:update') // this.$auth.hasPermi('equipment:spare-parts-config:update')
@ -119,16 +113,12 @@ export default {
{ prop: 'productionLine', label: '产线' }, { prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' }, { prop: 'workshopSection', label: '工段' },
{ prop: 'equipment', label: '设备名称' }, { prop: 'equipment', label: '设备名称' },
{ { prop: 'alarmGrade', label: '报警级别', filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL) },
prop: 'alarmGrade', { prop: 'responsible', label: '报警时间' }, //
label: '报警级别', { prop: 'responsible1', label: '设备报警码' }, //
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
},
{ prop: 'createTime', label: '报警时间', filter: timeFilter }, //
{ prop: 'alarmCode', label: '设备报警码' }, //
{ prop: 'alarmContent', label: '报警内容' }, { prop: 'alarmContent', label: '报警内容' },
{ prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn }, { prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn },
{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn }, // TODO: { prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn }, // TODO:
// { prop: 'remark', label: '' }, // { prop: 'remark', label: '' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
@ -145,8 +135,8 @@ export default {
dateType: 'daterange', // datetimerange dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd HH:mm:ss', // format: 'yyyy-MM-dd HH:mm:ss',
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
valueFormat: 'timestamp', // valueFormat: 'timestamp',
// valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始日期', startPlaceholder: '开始日期',
endPlaceholder: '结束日期', endPlaceholder: '结束日期',
@ -206,10 +196,9 @@ export default {
pageSize: 10, pageSize: 10,
lineId: null, lineId: null,
equipmentId: null, equipmentId: null,
recordTime: []
}, },
basePath: '/base/equipment-alarm-log', basePath: '/base/equipment-alarm-log',
list: [], list: []
}; };
}, },
created() { created() {
@ -217,20 +206,21 @@ export default {
}, },
methods: { methods: {
handleEmitFun(val) { handleEmitFun(val) {
console.log('你好', val)
if (val.action === '报警处理') { if (val.action === '报警处理') {
// this.chosedLogId = val.value.alarmId;
this.chosedLogId = val.value.id;
// //
this.open = true; this.open = true
this.title = '报警处理'; this.title = '报警处理'
this.readOnly = false; this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.value.id);
});
} else { } else {
// this.chosedLogId = val.value.alarmId;
this.chosedLogId = val.value.id;
// //
this.open = true; this.open = true
this.title = '查看'; this.title = '查看'
this.readOnly = true; this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.value.id, true);
});
} }
}, },
/** 查询列表 */ /** 查询列表 */
@ -244,9 +234,9 @@ export default {
}); });
}, },
successSubmit() { successSubmit() {
this.cancel(); this.cancel()
this.getList(); this.getList()
}, },
/** 取消按钮 */ /** 取消按钮 */
cancel() { cancel() {
this.open = false; this.open = false;
@ -292,7 +282,7 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs.addOrUpdate.submit(); this.$refs.addOrUpdate.dataFormSubmit()
// this.$refs['form'].validate((valid) => { // this.$refs['form'].validate((valid) => {
// if (!valid) { // if (!valid) {
// return; // return;

View File

@ -12,7 +12,7 @@
:wrapper-closable="false" :wrapper-closable="false"
class="drawer" class="drawer"
custom-class="mes-drawer" custom-class="mes-drawer"
:size="size || '50%'" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title"> <SmallTitle slot="title">
{{ {{
@ -42,8 +42,7 @@
:dataForm="form" :dataForm="form"
:rows="formRows" /> --> :rows="formRows" /> -->
<!-- if --> <el-row style="margin-bottom: 24px">
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
<el-col :span="8"> <el-col :span="8">
<div <div
class="title" class="title"
@ -63,39 +62,13 @@
</div> </div>
</el-col> </el-col>
</el-row> </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>
<div <div
v-if="section.key == 'attrs'" v-if="section.key == 'attrs'"
style="position: relative; margin-top: 12px"> style="position: relative; margin-top: 12px">
<div <!-- v-if="!mode.includes('detail')" -->
v-if="!mode.includes('detail')" <div style="position: absolute; top: -40px; right: 0">
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
添加报警 添加报警
@ -111,7 +84,7 @@
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'" <!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" --> @emitButtonClick="handleAddAttr" -->
<method-btn <method-btn
v-if="section.tableBtn && !mode.includes('detail')" v-if="section.tableBtn"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@ -130,13 +103,11 @@
</div> </div>
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">返回</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<el-button <!-- <el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
type="primary" 编辑
v-if="!mode.includes('detail')" </el-button> -->
@click="handleSave"> <!-- <el-button v-else type="primary" @click="handleCancel">确定</el-button> -->
保存
</el-button>
</div> </div>
</div> </div>
@ -192,7 +163,7 @@ const SmallTitle = {
export default { export default {
components: { SmallTitle, DialogForm, BaseInfoForm }, components: { SmallTitle, DialogForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'dataId', 'size'], // dataId id props: ['sections', 'defaultMode', 'dataId'], // dataId id
data() { data() {
return { return {
mode: '', mode: '',
@ -220,9 +191,7 @@ export default {
label: '报警编码', // label: '报警编码', //
prop: 'code', prop: 'code',
url: '/base/equipment-group-alarm/getCode', url: '/base/equipment-group-alarm/getCode',
rules: [ rules: [{ required: true, message: '报警编码不能为空', trigger: 'blur' }],
{ required: true, message: '报警编码不能为空', trigger: 'blur' },
],
}, },
{ {
select: true, select: true,
@ -236,17 +205,13 @@ export default {
input: true, input: true,
label: '参数列名', // label: '参数列名', //
prop: 'plcParamName', prop: 'plcParamName',
rules: [ rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
],
}, },
{ {
input: true, input: true,
label: '报警内容', label: '报警内容',
prop: 'alarmContent', prop: 'alarmContent',
rules: [ rules: [{ required: true, message: '报警内容不能为空', trigger: 'blur' }],
{ required: true, message: '报警内容不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -258,9 +223,7 @@ export default {
{ label: '布尔型', value: 2 }, { label: '布尔型', value: 2 },
{ label: '字符型', value: 1 }, { label: '字符型', value: 1 },
], ],
rules: [ rules: [{ required: true, message: '报警类型不能为空', trigger: 'blur' }],
{ required: true, message: '报警类型不能为空', trigger: 'blur' },
],
}, },
{ {
input: true, input: true,
@ -359,7 +322,7 @@ export default {
handleSave() { handleSave() {
this.$refs['form'][0].validate(async (valid) => { this.$refs['form'][0].validate(async (valid) => {
if (valid) { if (valid) {
const isEdit = !this.mode.includes('detail'); const isEdit = this.mode == 'edit';
await this.$axios({ await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post', method: isEdit ? 'put' : 'post',
@ -440,32 +403,32 @@ export default {
}, },
// //
submitAttrForm() { async submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => { this.$refs['attrForm'].validate((valid) => {
if (!valid) { if (!valid) {
return; 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();
},
});
}
this.attrFormSubmitting = false;
}); });
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();
},
});
}
this.attrFormSubmitting = false;
}, },
closeAttrForm() { closeAttrForm() {

View File

@ -45,7 +45,6 @@
<BasicDrawer <BasicDrawer
v-if="editVisible" v-if="editVisible"
ref="drawer" ref="drawer"
size="45%"
:default-mode="editMode" :default-mode="editMode"
:data-id="alarmForm.id" :data-id="alarmForm.id"
:sections="[ :sections="[
@ -404,25 +403,12 @@ 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, mode = 'detail') { handleDetail(row) {
// debugger; // debugger;
const { id, code, name, createTime } = row; const { id, code, name, createTime } = row;
// //
this.editMode = mode; this.editMode = 'detail';
this.alarmForm.id = id; this.alarmForm.id = id;
this.alarmForm.equipmentGroupCode = code; this.alarmForm.equipmentGroupCode = code;
this.alarmForm.equipmentGroupName = name; this.alarmForm.equipmentGroupName = name;

View File

@ -12,7 +12,7 @@
:wrapper-closable="false" :wrapper-closable="false"
class="drawer" class="drawer"
custom-class="mes-drawer" custom-class="mes-drawer"
:size="size || '50%'" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title"> <SmallTitle slot="title">
{{ {{
@ -42,7 +42,7 @@
:dataForm="form" :dataForm="form"
:rows="formRows" /> --> :rows="formRows" /> -->
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px"> <el-row style="margin-bottom: 24px">
<el-col :span="8"> <el-col :span="8">
<div <div
class="title" class="title"
@ -62,38 +62,13 @@
</div> </div>
</el-col> </el-col>
</el-row> </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>
<div <div
v-if="section.key == 'attrs'" v-if="section.key == 'attrs'"
style="position: relative; margin-top: 12px"> style="position: relative; margin-top: 12px">
<div <!-- v-if="!mode.includes('detail')" -->
v-if="!mode.includes('detail')" <div style="position: absolute; top: -40px; right: 0">
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
添加属性 添加属性
@ -109,7 +84,7 @@
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'" <!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" --> @emitButtonClick="handleAddAttr" -->
<method-btn <method-btn
v-if="section.tableBtn && !mode.includes('detail')" v-if="section.tableBtn"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@ -129,12 +104,10 @@
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<el-button <!-- <el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
type="primary" 编辑
v-if="!mode.includes('detail')" </el-button> -->
@click="handleSave"> <!-- <el-button v-else type="primary" @click="handleCancel">确定</el-button> -->
保存
</el-button>
</div> </div>
</div> </div>
@ -190,7 +163,7 @@ const SmallTitle = {
export default { export default {
components: { SmallTitle, DialogForm, BaseInfoForm }, components: { SmallTitle, DialogForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'dataId', 'size'], // dataId id props: ['sections', 'defaultMode', 'dataId'], // dataId id
data() { data() {
return { return {
mode: '', mode: '',
@ -218,9 +191,7 @@ export default {
label: '报警编码', // label: '报警编码', //
prop: 'code', prop: 'code',
url: '/base/equipment-group-alarm/getCode', url: '/base/equipment-group-alarm/getCode',
rules: [ rules: [{ required: true, message: '报警编码不能为空', trigger: 'blur' }],
{ required: true, message: '报警编码不能为空', trigger: 'blur' },
],
}, },
{ {
select: true, select: true,
@ -230,9 +201,7 @@ export default {
{ label: '布尔型', value: 2 }, { label: '布尔型', value: 2 },
{ label: '字符型', value: 1 }, { label: '字符型', value: 1 },
], ],
rules: [ rules: [{ required: true, message: '报警类型不能为空', trigger: 'blur' }],
{ required: true, message: '报警类型不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -253,17 +222,13 @@ export default {
input: true, input: true,
label: '参数列名', // label: '参数列名', //
prop: 'plcParamName', prop: 'plcParamName',
rules: [ rules: [{ required: true, message: '参数列名不能为空', trigger: 'blur' }],
{ required: true, message: '参数列名不能为空', trigger: 'blur' },
],
}, },
{ {
input: true, input: true,
label: '报警内容', label: '报警内容',
prop: 'alarmContent', prop: 'alarmContent',
rules: [ rules: [{ required: true, message: '报警内容不能为空', trigger: 'blur' }],
{ required: true, message: '报警内容不能为空', trigger: 'blur' },
],
}, },
], ],
], ],
@ -357,7 +322,7 @@ export default {
handleSave() { handleSave() {
this.$refs['form'][0].validate(async (valid) => { this.$refs['form'][0].validate(async (valid) => {
if (valid) { if (valid) {
const isEdit = !this.mode.includes('detail'); const isEdit = this.mode == 'edit';
await this.$axios({ await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post', method: isEdit ? 'put' : 'post',
@ -438,32 +403,33 @@ export default {
}, },
// //
submitAttrForm() { async submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => { this.$refs['attrForm'].validate((valid) => {
if (!valid) { if (!valid) {
return; 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();
},
});
}
this.attrFormSubmitting = false;
}); });
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();
},
});
}
this.attrFormSubmitting = false;
}, },
closeAttrForm() { closeAttrForm() {

View File

@ -45,7 +45,6 @@
<BasicDrawer <BasicDrawer
v-if="editVisible" v-if="editVisible"
ref="drawer" ref="drawer"
size="45%"
:default-mode="editMode" :default-mode="editMode"
:data-id="alarmForm.id" :data-id="alarmForm.id"
:sections="[ :sections="[
@ -225,9 +224,7 @@ export default {
bind: { bind: {
filterable: true, filterable: true,
}, },
rules: [ rules: [{ required: true, message: '设备不能为空', trigger: 'blur' }],
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
}, },
], ],
[ [
@ -241,9 +238,7 @@ export default {
bind: { bind: {
filterable: true, filterable: true,
}, },
rules: [ rules: [{ required: true, message: '报警分组不能为空', trigger: 'blur' }],
{ required: true, message: '报警分组不能为空', trigger: 'blur' },
],
}, },
], ],
], ],
@ -274,13 +269,7 @@ export default {
input: true, input: true,
label: '设备分组名称', label: '设备分组名称',
prop: 'name', prop: 'name',
rules: [ rules: [{ required: true, message: '设备分组名称不能为空', trigger: 'blur' }],
{
required: true,
message: '设备分组名称不能为空',
trigger: 'blur',
},
],
// bind: { // bind: {
// disabled: this.editMode == 'detail', // some condition, like detail mode... // disabled: this.editMode == 'detail', // some condition, like detail mode...
// } // }
@ -298,23 +287,26 @@ export default {
prop: 'createTime', prop: 'createTime',
label: '添加时间', label: '添加时间',
fixed: true, fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
}, },
{ prop: 'code', label: '报警编码' }, { width: 240, prop: 'code', label: '报警编码' },
{ {
width: 100,
prop: 'type', prop: 'type',
label: '报警类型', label: '报警类型',
filter: (val) => filter: (val) =>
val != null ? ['-', '字符型', '布尔型', '-'][val] : '-', val != null ? ['-', '字符型', '布尔型', '-'][val] : '-',
}, },
{ {
width: 90,
prop: 'grade', prop: 'grade',
label: '报警级别', label: '报警级别',
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL), filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
}, },
{ prop: 'alarmCode', label: '设备报警编码' }, { width: 180, prop: 'alarmCode', label: '设备报警编码' },
{ prop: 'plcParamName', label: '参数列名' }, { width: 128, prop: 'plcParamName', label: '参数列名' },
{ prop: 'alarmContent', label: '报警内容' }, { width: 128, prop: 'alarmContent', label: '报警内容' },
], ],
}; };
}, },
@ -369,19 +361,6 @@ export default {
}; };
this.resetForm('form'); 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() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
@ -432,11 +411,11 @@ export default {
}); });
}, },
// //
handleDetail(row, mode = 'detail') { handleDetail(row) {
const { equipmentId, equipmentName, groupCode, groupId, groupName, id } = const { equipmentId, equipmentName, groupCode, groupId, groupName, id } =
row; row;
// //
this.editMode = mode; this.editMode = 'detail';
this.alarmForm.id = groupId; this.alarmForm.id = groupId;
this.alarmForm.equipmentGroupCode = groupCode; this.alarmForm.equipmentGroupCode = groupCode;
this.alarmForm.equipmentGroupName = groupName; this.alarmForm.equipmentGroupName = groupName;

View File

@ -52,7 +52,6 @@
<BasicDrawer <BasicDrawer
v-if="editVisible" v-if="editVisible"
ref="drawer" ref="drawer"
size="45%"
:default-mode="editMode" :default-mode="editMode"
:info-data="alarmForm" :info-data="alarmForm"
:sections="[ :sections="[
@ -60,10 +59,6 @@
name: '基本信息', name: '基本信息',
key: 'base', key: 'base',
rows: drawerBaseInfoRows, 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: '采集参数', name: '采集参数',
@ -194,7 +189,7 @@ export default {
placeholder: '请选择设备', placeholder: '请选择设备',
param: 'equipmentId', param: 'equipmentId',
selectOptions: [], selectOptions: [],
filterable: true, filterable: true
}, },
{ {
type: 'select', type: 'select',
@ -202,7 +197,7 @@ export default {
placeholder: '请选择关联表编码', placeholder: '请选择关联表编码',
param: 'plcId', param: 'plcId',
selectOptions: [], selectOptions: [],
filterable: true, filterable: true
}, },
{ {
type: 'button', type: 'button',
@ -316,8 +311,8 @@ export default {
label: '生产参数类型', label: '生产参数类型',
filter: (val) => filter: (val) =>
val != null val != null
? // ? ['', '', '', '', '', ''][val] // ? ['', '', '', '', '', ''][val]
['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val] ? ['', '进口计数', '出口计数', '损耗计数', '无类型', ''][val]
: '-', : '-',
}, },
{ {
@ -428,19 +423,6 @@ export default {
}; };
this.resetForm('form'); 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() { handleQuery() {
this.queryParams.pageNo = 1; this.queryParams.pageNo = 1;
@ -492,7 +474,7 @@ export default {
}, },
// //
handleDetail(row, mode = 'detail') { handleDetail(row) {
// debugger; // debugger;
const { const {
id, id,
@ -508,7 +490,7 @@ export default {
workshopSection, workshopSection,
} = row; } = row;
// //
this.editMode = mode; this.editMode = 'detail';
this.alarmForm.id = id; this.alarmForm.id = id;
this.alarmForm.plcTableName = plcTableName; // this.alarmForm.plcTableName = plcTableName; //
this.alarmForm.equipmentName = equipmentName; this.alarmForm.equipmentName = equipmentName;

View File

@ -12,7 +12,7 @@
:wrapper-closable="false" :wrapper-closable="false"
class="drawer" class="drawer"
custom-class="mes-drawer" custom-class="mes-drawer"
:size="size || '50%'" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title"> <SmallTitle slot="title">
{{ {{
@ -42,8 +42,7 @@
v-model="form" v-model="form"
:rows="formRows" /> --> :rows="formRows" /> -->
<!-- if --> <el-row style="margin-bottom: 24px">
<el-row v-if="mode.includes('detail')" style="margin-bottom: 24px">
<el-col :span="8"> <el-col :span="8">
<div <div
class="title" class="title"
@ -65,39 +64,13 @@
</div> </div>
</el-col> </el-col>
</el-row> </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>
<div <div
v-if="section.key == 'attrs'" v-if="section.key == 'attrs'"
style="position: relative; margin-top: 12px"> style="position: relative; margin-top: 12px">
<div <!-- v-if="!mode.includes('detail')" -->
v-if="!mode.includes('detail')" <div style="position: absolute; top: -40px; right: 0">
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
添加属性 添加属性
@ -113,7 +86,7 @@
<!-- :add-button-show="mode.includes('detail') ? null : '添加属性'" <!-- :add-button-show="mode.includes('detail') ? null : '添加属性'"
@emitButtonClick="handleAddAttr" --> @emitButtonClick="handleAddAttr" -->
<method-btn <method-btn
v-if="section.tableBtn && !mode.includes('detail')" v-if="section.tableBtn"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@ -133,12 +106,10 @@
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button> <el-button style="" @click="handleCancel">取消</el-button>
<el-button <!-- <el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
type="primary" 编辑
v-if="!mode.includes('detail')" </el-button> -->
@click="handleSave"> <!-- <el-button v-else type="primary" @click="handleCancel">确定</el-button> -->
保存
</el-button>
</div> </div>
</div> </div>
@ -193,7 +164,7 @@ const SmallTitle = {
export default { export default {
components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm }, components: { SmallTitle, DialogForm: BaseInfoForm, BaseInfoForm },
props: ['sections', 'defaultMode', 'infoData', 'size'], props: ['sections', 'defaultMode', 'infoData'],
data() { data() {
return { return {
mode: '', mode: '',
@ -441,7 +412,7 @@ export default {
handleSave() { handleSave() {
this.$refs['form'][0].validate(async (valid) => { this.$refs['form'][0].validate(async (valid) => {
if (valid) { if (valid) {
const isEdit = !this.mode.includes('detail'); const isEdit = this.mode == 'edit';
await this.$axios({ await this.$axios({
url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'], url: this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: isEdit ? 'put' : 'post', method: isEdit ? 'put' : 'post',

View File

@ -77,9 +77,9 @@
<el-form-item label="巡检时间" prop="actualTime"> <el-form-item label="巡检时间" prop="actualTime">
<el-date-picker <el-date-picker
v-model="dataForm.actualTime" v-model="dataForm.actualTime"
type="datetime" type="date"
:disabled="isdetail" :disabled="isdetail"
format='yyyy-MM-dd HH:mm:ss' format='yyyy-MM-dd'
value-format="timestamp" value-format="timestamp"
placeholder="选择巡检时间" /> placeholder="选择巡检时间" />
</el-form-item> </el-form-item>

View File

@ -69,7 +69,7 @@ export default {
data() { data() {
return { return {
addOrUpdateVisible: false, addOrUpdateVisible: false,
searchBarKeys: ['equipmentId', 'actualTime'], searchBarKeys: ['equipmentId', 'createTime'],
tableBtn: [ tableBtn: [
this.$auth.hasPermi('equipment:check-record:detail') this.$auth.hasPermi('equipment:check-record:detail')
? { ? {
@ -113,12 +113,12 @@ export default {
label: '时间段', label: '时间段',
dateType: 'daterange', // datetimerange dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'timestamp',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始日期', startPlaceholder: '开始日期',
endPlaceholder: '结束日期', endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'], defaultTime: ['00:00:00', '23:59:59'],
param: 'actualTime', param: 'startTime',
// width: 350, // width: 350,
}, },
{ {

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-24 18:38:22 * @LastEditTime: 2023-11-09 11:09:26
* @Description: * @Description:
--> -->
<template> <template>
@ -52,10 +52,11 @@
<div v-if="!isdetail" class="action_btn"> <div v-if="!isdetail" class="action_btn">
<template> <template>
<span style="display: inline-block;"> <span style="display: inline-block;" @click="addNew()">
<el-button type="text" @click="addNew()" icon="el-icon-plus">添加</el-button> <svg-icon style="width: 14px; height: 14px" class="item-icon" icon-class="table_add" />
</span> <span class="add">添加</span>
</template> </span>
</template>
</div> </div>
<base-table <base-table
:table-props="tableProps" :table-props="tableProps"
@ -289,7 +290,7 @@ export default {
.drawer >>> .visual-part { .drawer >>> .visual-part {
flex: 1 auto; flex: 1 auto;
max-height: 16vh; max-height: 76vh;
overflow: hidden; overflow: hidden;
overflow-y: scroll; overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */ padding-right: 10px; /* 调整滚动条样式 */
@ -307,7 +308,7 @@ export default {
} }
.action_btn { .action_btn {
float: right; float: right;
margin: -40px 15px; margin: 5px 15px;
font-size: 14px; font-size: 14px;
} }
.add { .add {

View File

@ -101,7 +101,7 @@ export default {
{ prop: 'sectionName', label: '工段' }, { prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备' }, { prop: 'equipmentName', label: '设备' },
{ prop: 'equipmentCode', label: '设备编码' }, { prop: 'equipmentCode', label: '设备编码' },
// { prop: 'responsible', label: '' }, { prop: 'responsible', label: '负责人' },
{ prop: 'checkNumber', label: '巡检条数' }, // TODO: { prop: 'checkNumber', label: '巡检条数' }, // TODO:
], ],
searchBarFormConfig: [ searchBarFormConfig: [
@ -116,7 +116,6 @@ export default {
label: '设备名称', label: '设备名称',
placeholder: '请选择设备', placeholder: '请选择设备',
param: 'equipmentId', param: 'equipmentId',
filterable: true,
}, },
{ {
type: 'button', type: 'button',
@ -171,12 +170,8 @@ export default {
label: '设备名称', label: '设备名称',
prop: 'equipmentId', prop: 'equipmentId',
url: '/base/core-equipment/listAll', url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
},
rules: [ rules: [
{ required: true, message: '设备名称不能为空', trigger: 'change' }, { required: true, message: '设备名称不能为空', trigger: 'blur' },
], ],
}, },
{ {

View File

@ -45,11 +45,6 @@
:disabled="mode == 'detail'" :disabled="mode == 'detail'"
:has-files="true" :has-files="true"
:rows="rows" /> :rows="rows" />
<el-row v-if="mode === 'detail'" slot="footer" type="flex" justify="end">
<el-col :span="12">
<el-button size="small" class="btnTextStyle" @click="cancel">关闭</el-button>
</el-col>
</el-row>
</base-dialog> </base-dialog>
</div> </div>
</template> </template>

View File

@ -75,6 +75,9 @@
<div class="drawer-body__footer"> <div class="drawer-body__footer">
<el-button type="primary" @click="goback()">关闭</el-button> <el-button type="primary" @click="goback()">关闭</el-button>
<el-button v-if="disabled" type="primary" @click="goEdit()">
编辑
</el-button>
</div> </div>
<attr-add <attr-add

View File

@ -35,7 +35,7 @@
</el-form> </el-form>
<el-row style="text-align: right"> <el-row style="text-align: right">
<el-button @click="cancel">取消</el-button> <el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row> </el-row>
</el-dialog> </el-dialog>
@ -79,13 +79,21 @@ export default {
this.partList = res.data.list; this.partList = res.data.list;
}) })
}, },
cancel() {
this.$refs['dataForm'].resetFields()
this.visible = false
},
init(id) { init(id) {
// this.dataForm.id = id || ''; this.dataForm.id = id || '';
this.visible = true; this.visible = true;
// this.$nextTick(() => {
// this.$refs['dataForm'].resetFields();
// if (this.dataForm.id) {
// getCoreProductAttr({
// id: this.dataForm.id
// }).then((res) => {
// const { name, value } = res.data;
// this.dataForm.name = name;
// this.dataForm.value = value;
// });
// }
// });
}, },
// //
dataFormSubmit() { dataFormSubmit() {
@ -109,7 +117,6 @@ export default {
configId: this.configId, configId: this.configId,
}).then((response) => { }).then((response) => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
this.$refs['dataForm'].resetFields()
this.visible = false; this.visible = false;
this.$emit('refreshDataList'); this.$emit('refreshDataList');
}); });

View File

@ -301,12 +301,6 @@ export default {
const id = row.id; const id = row.id;
this.info({ id }).then((response) => { this.info({ id }).then((response) => {
this.form = response.data; this.form = response.data;
if (this.form.unit !== undefined) {
this.form.unit = String(this.form.unit)
}
if (this.form.type !== undefined) {
this.form.type = String(this.form.type)
}
this.open = true; this.open = true;
this.title = '修改备品备件'; this.title = '修改备品备件';
}); });

View File

@ -310,8 +310,7 @@ export default {
handleClick(raw) { handleClick(raw) {
if (raw.type === 'change') { if (raw.type === 'change') {
// //
console.log(raw) this.addNew();
this.addNew(raw.data.sparePartId);
} else {} } else {}
}, },
getList() { getList() {
@ -321,7 +320,7 @@ export default {
configId: this.dataForm.id, configId: this.dataForm.id,
}).then((response) => { }).then((response) => {
this.list = response.data; this.list = response.data;
this.listQuery.total = response.data.length; this.listQuery.total = response.data.total;
}); });
}, },
getList1() { getList1() {
@ -335,10 +334,10 @@ export default {
}); });
}, },
// / // /
addNew(sparePartId) { addNew(id) {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(sparePartId); this.$refs.addOrUpdate.init(id);
}); });
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */

View File

@ -25,27 +25,10 @@
clearable clearable
placeholder="请输入操作人" /> placeholder="请输入操作人" />
</el-form-item> </el-form-item>
<el-form-item label="更换耗时(min)" prop="timeUsed">
<el-input-number
v-model="dataForm.timeUsed"
controls-position="right"
clearable
placeholder="请输入更换耗时"
style="width: 100%" />
</el-form-item>
<el-form-item label="更换时间" prop="replacementTime">
<el-date-picker
v-model="dataForm.replacementTime"
type="date"
format='yyyy-MM-dd'
value-format='timestamp'
placeholder="选择入更换时间"
style="width: 100%" />
</el-form-item>
</el-form> </el-form>
<el-row style="text-align: right"> <el-row style="text-align: right">
<el-button @click="cancel">取消</el-button> <el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button> <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row> </el-row>
</el-dialog> </el-dialog>
@ -66,15 +49,11 @@ export default {
visible: false, visible: false,
dataForm: { dataForm: {
id: undefined, id: undefined,
responsible: '', responsible: ''
timeUsed: 0,
sparePartId: '',
replacementTime: undefined
}, },
partList: [], partList: [],
dataRule: { dataRule: {
responsible: [{ required: true, message: '操作人不能为空', trigger: 'blur' }], responsible: [{ required: true, message: '操作人不能为空', trigger: 'blur' }]
replacementTime: [{ required: true, message: '更换时间不能为空', trigger: 'blur' }]
}, },
}; };
}, },
@ -87,13 +66,9 @@ export default {
// this.partList = res.data // this.partList = res.data
// }, // },
init(id) { init(id) {
this.dataForm.sparePartId = id || undefined; this.dataForm.id = id || '';
this.visible = true; this.visible = true;
}, },
cancel() {
this.$refs['dataForm'].resetFields();
this.visible = false;
},
// //
dataFormSubmit() { dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
@ -116,7 +91,6 @@ export default {
configId: this.configId, configId: this.configId,
}).then((response) => { }).then((response) => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
this.$refs['dataForm'].resetFields();
this.visible = false; this.visible = false;
this.$emit('refreshDataList'); this.$emit('refreshDataList');
}); });

View File

@ -105,12 +105,7 @@ export default {
} }
this.listEq.splice(0); this.listEq.splice(0);
}, },
handleSearch() { handleSearch() {},
this.$emit('action', {
action: 'search',
payload: this.form,
});
},
}, },
}; };
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<SearchBarNew v-model="searchBarForm" @action="handleSearchBarActions" /> <SearchBarNew v-model="searchBarForm" />
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
@ -128,31 +128,13 @@ export default {
list: [], list: [],
}; };
}, },
mounted() {
this.getList();
},
methods: { methods: {
/** handleEmitFun(val) {
* 处理表格按钮点击事件 console.log('你好', val);
* @param {string} action 按钮名称 if (val.action === '状态可视化') {
* @param {object} value 按钮数据(行数据) { equipmentId, equipmentCode, equipmentName, inQuantity, outQuantity, run, status, error, quantityRecordTime, statusRecordTime}
*/
handleEmitFun({ action, value: row } = {}) {
if (action === '状态可视化') {
// //
} 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 { } else {
//
} }
}, },
/** 查询列表 */ /** 查询列表 */
@ -190,25 +172,9 @@ export default {
// }; // };
// this.resetForm('form'); // this.resetForm('form');
// }, // },
handleSearchBarActions({ action, payload }) {
switch (action) {
case 'search':
this.handleQuery();
break;
case 'reset':
this.resetQuery();
break;
default:
break;
}
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams = { this.queryParams.pageNo = 1;
...this.queryParams,
...this.searchBarForm,
pageNo: 1,
};
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */

View File

@ -35,12 +35,12 @@
" /> " />
</div> </div>
</div> </div>
<div v-else class="no-data-bg"></div> <div v-else class="no-data-bg">
</div>
</div> </div>
</template> </template>
<script> <script>
import { Message } from 'element-ui';
import LocalDataManager from './utils/local-data-manager'; import LocalDataManager from './utils/local-data-manager';
// import response from './response'; // import response from './response';
import moment from 'moment'; import moment from 'moment';
@ -55,6 +55,7 @@ export default {
const today = new Date(y, m, d, 0, 0, 0, 0).getTime(); const today = new Date(y, m, d, 0, 0, 0, 0).getTime();
const aWeekAgo = today - 3600 * 1000 * 24 * 7; const aWeekAgo = today - 3600 * 1000 * 24 * 7;
return { return {
tableList: [],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',
@ -108,67 +109,35 @@ export default {
], ],
}; };
}, },
beforeRouteEnter(to, from, next) { computed: {
if (Object.keys(to.params).length > 0) { id() {
next((vm) => { return this.$route.params.equipmentId;
vm.$set(vm.queryParams, 'id', to.params.equipmentId); },
vm.$set( code() {
vm.searchBarFormConfig[0], return this.$route.params.equipmentCode;
'defaultSelect', },
to.params.equipmentCode name() {
); return this.$route.params.equipmentName;
vm.$set( },
vm.searchBarFormConfig[1],
'defaultSelect',
to.params.equipmentName
);
vm.handleQuery();
});
} else {
// let timeleft = 3;
// 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) { mounted() {
// clean job if (this.id) this.$set(this.queryParams, 'id', this.id);
this.$set(this.queryParams, 'id', null); if (this.code)
this.$set(this.searchBarFormConfig[0], 'defaultSelect', null); this.$set(this.searchBarFormConfig[0], 'defaultSelect', this.code);
this.$set(this.searchBarFormConfig[1], 'defaultSelect', null); if (this.name)
this.tableList = []; this.$set(this.searchBarFormConfig[1], 'defaultSelect', this.name);
next();
// this.handleResponse();
}, },
methods: { methods: {
buildProps(table) { buildProps(table) {
console.log('building props', table);
// otherList props // otherList props
const { otherList } = table; const { otherList } = table;
const props = [ const props = [
{ {
// type: 'index', // type: 'index',
width: 56, width: 48,
prop: 'index', prop: 'index',
label: '序号', label: '序号',
}, },
@ -178,7 +147,7 @@ export default {
label: '时间', label: '时间',
}, },
{ {
width: 240, width: 200,
prop: 'plcCode', prop: 'plcCode',
label: 'PLC编码', label: 'PLC编码',
}, },

View File

@ -17,7 +17,7 @@
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="240" :width="320"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleClick" @clickBtn="handleClick"

View File

@ -73,7 +73,7 @@ const tableProps = [
{ {
prop: 'status', prop: 'status',
label: '订单状态', label: '订单状态',
filter: publicFormatter('order_status') filter: publicFormatter('order_priority')
}, },
{ {
prop: 'startProduceTime', prop: 'startProduceTime',
@ -88,7 +88,7 @@ const tableProps = [
minWidth: 160 minWidth: 160
}, },
{ {
prop: 'lineNames', prop: 'productLines',
label: '加工线', label: '加工线',
filter: (val) => val ? val.join(',') : '', filter: (val) => val ? val.join(',') : '',
minWidth: 180 minWidth: 180