修改bug
This commit is contained in:
301
src/views/equipment/base/alarm/Record/AddOrUpdate.vue
Normal file
301
src/views/equipment/base/alarm/Record/AddOrUpdate.vue
Normal file
@@ -0,0 +1,301 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-11 20:33:12
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div class="alarm-handle">
|
||||
<el-skeleton v-if="loading" />
|
||||
<div v-else>
|
||||
<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>
|
||||
</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 {
|
||||
loading: false,
|
||||
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',
|
||||
bind: {
|
||||
multiple: true,
|
||||
},
|
||||
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.loading = true;
|
||||
this.getDict()
|
||||
.then(() => {
|
||||
this.init();
|
||||
})
|
||||
.catch((err) => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取员工数据
|
||||
*/
|
||||
async getDict() {
|
||||
const workerRes = await getworkerAll();
|
||||
this.workersList = workerRes.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
async init() {
|
||||
await this.initTop();
|
||||
await this.initDown();
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化上部表单
|
||||
*/
|
||||
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/page'; // 经沟通,此处采用page接口的第一个返回值
|
||||
const { data, code } = await this.$axios({
|
||||
url: url,
|
||||
method: 'get',
|
||||
params: {
|
||||
logId: this.logId,
|
||||
},
|
||||
});
|
||||
if (code == 0) {
|
||||
this.handleMethodForm = {
|
||||
...data.list[0],
|
||||
hander: data.list[0]?.hander?.split(',') || '',
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新表单
|
||||
*/
|
||||
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,
|
||||
hander: this.handleMethodForm.hander?.join(',') || '',
|
||||
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,28 @@
|
||||
: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';
|
||||
<<<<<<< HEAD
|
||||
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');
|
||||
>>>>>>> projects/mes-test
|
||||
|
||||
const btn = {
|
||||
name: 'tableBtn',
|
||||
@@ -68,7 +76,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,15 +91,19 @@ const btn = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'Record',
|
||||
components: { AddOrUpdate },
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
<<<<<<< HEAD
|
||||
searchBarKeys: ['equipmentName', 'createTime'],
|
||||
=======
|
||||
readOnly: false,
|
||||
chosedLogId: false,
|
||||
searchBarKeys: ['equipmentName', 'recordTime'],
|
||||
>>>>>>> projects/mes-test
|
||||
tableBtn: [
|
||||
// this.$auth.hasPermi('equipment:spare-parts-config:update')
|
||||
// ? {
|
||||
@@ -113,12 +128,22 @@ export default {
|
||||
{ prop: 'productionLine', label: '产线' },
|
||||
{ prop: 'workshopSection', label: '工段' },
|
||||
{ prop: 'equipment', label: '设备名称' },
|
||||
<<<<<<< HEAD
|
||||
{ prop: 'alarmGrade', label: '报警级别', filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL) },
|
||||
{ prop: 'createTime', label: '报警时间',filter: timeFilter }, // 接口缺
|
||||
{ prop: 'responsible1', label: '设备报警码' }, // 接口缺
|
||||
=======
|
||||
{
|
||||
prop: 'alarmGrade',
|
||||
label: '报警级别',
|
||||
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
|
||||
},
|
||||
{ prop: 'createTime', label: '报警时间', filter: timeFilter }, // 接口缺
|
||||
{ prop: 'alarmCode', label: '设备报警码' }, // 接口缺
|
||||
>>>>>>> projects/mes-test
|
||||
{ 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 +160,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 +221,10 @@ export default {
|
||||
pageSize: 10,
|
||||
lineId: null,
|
||||
equipmentId: null,
|
||||
recordTime: []
|
||||
},
|
||||
basePath: '/base/equipment-alarm-log',
|
||||
list: []
|
||||
list: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -206,21 +232,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 +259,9 @@ export default {
|
||||
});
|
||||
},
|
||||
successSubmit() {
|
||||
this.cancel()
|
||||
this.getList()
|
||||
},
|
||||
this.cancel();
|
||||
this.getList();
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.open = false;
|
||||
@@ -282,7 +307,7 @@ export default {
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs.addOrUpdate.dataFormSubmit()
|
||||
this.$refs.addOrUpdate.submit();
|
||||
// this.$refs['form'].validate((valid) => {
|
||||
// if (!valid) {
|
||||
// return;
|
||||
@@ -310,7 +335,7 @@ export default {
|
||||
this.$modal
|
||||
.confirm('是否确认删除记录"' + row.name + '"?')
|
||||
.then(function () {
|
||||
return this.delete({ id });
|
||||
return this.del({ id });
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
|
||||
@@ -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="[
|
||||
@@ -198,26 +199,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: '报警内容' },
|
||||
],
|
||||
alarmForm: {
|
||||
id: undefined,
|
||||
@@ -406,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,6 +42,7 @@
|
||||
:dataForm="form"
|
||||
:rows="formRows" /> -->
|
||||
|
||||
<!-- <el-row v-if="mode.includes('detail')" style="margin-bottom: 24px"> -->
|
||||
<el-row style="margin-bottom: 24px">
|
||||
<el-col :span="8">
|
||||
<div
|
||||
@@ -62,13 +63,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 +110,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 +130,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="handleCancel">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -163,7 +191,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 +219,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 +231,9 @@ export default {
|
||||
{ label: '布尔型', value: 2 },
|
||||
{ label: '字符型', value: 1 },
|
||||
],
|
||||
rules: [{ required: true, message: '报警类型不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '报警类型不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -222,13 +254,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 +358,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 +439,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',
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import { deleteCheck } from "@/api/equipment/base/inspection/settings";
|
||||
import { deleteCheck } from '@/api/equipment/base/inspection/settings';
|
||||
|
||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
@@ -128,15 +128,21 @@ export default {
|
||||
label: '巡检内容编号',
|
||||
prop: 'code',
|
||||
url: '/base/equipment-check/getCode',
|
||||
rules: [{ required: true, message: '巡检内容编号不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '巡检内容编号不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '巡检项目',
|
||||
prop: 'program',
|
||||
rules: [{ required: true, message: '巡检项目不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -144,10 +150,10 @@ export default {
|
||||
input: true,
|
||||
label: '巡检内容',
|
||||
prop: 'content',
|
||||
rules: [{ required: true, message: '巡检内容不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '巡检内容不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '备注',
|
||||
@@ -168,7 +174,7 @@ export default {
|
||||
code: '',
|
||||
program: '',
|
||||
id: undefined,
|
||||
content: ''
|
||||
content: '',
|
||||
},
|
||||
basePath: '/base/equipment-check',
|
||||
mode: null,
|
||||
@@ -271,10 +277,10 @@ export default {
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除巡检项目名称为"' + row.program + '"的数据项?')
|
||||
.confirm('是否确认删除该巡检项目?')
|
||||
.then(function () {
|
||||
// return this.delete({ id });
|
||||
return deleteCheck(id)
|
||||
// return this.del({ id });
|
||||
return deleteCheck(id);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
|
||||
<template>
|
||||
<el-drawer
|
||||
ref="drawer"
|
||||
:visible.sync="visible"
|
||||
:show-close="false"
|
||||
:wrapper-closable="false"
|
||||
class="drawer"
|
||||
size="60%">
|
||||
<small-title slot="title" :no-padding="true">
|
||||
{{ isdetail ? '查看详情' : '新增' }}
|
||||
{{ isdetail ? '查看详情' : !dataForm.id ? '新增' : '编辑' }}
|
||||
</small-title>
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
@@ -77,9 +78,9 @@
|
||||
<el-form-item label="巡检时间" prop="actualTime">
|
||||
<el-date-picker
|
||||
v-model="dataForm.actualTime"
|
||||
type="date"
|
||||
type="datetime"
|
||||
:disabled="isdetail"
|
||||
format='yyyy-MM-dd'
|
||||
format='yyyy-MM-dd HH:mm:ss'
|
||||
value-format="timestamp"
|
||||
placeholder="选择巡检时间" />
|
||||
</el-form-item>
|
||||
@@ -93,20 +94,20 @@
|
||||
:table-data="list" />
|
||||
</el-form-item>
|
||||
<el-form-item label="巡检详情" prop="description">
|
||||
<editor v-model="dataForm.description" :read-only="isdetail" :min-height="380"/>
|
||||
<editor v-model="dataForm.description" :read-only="isdetail" :min-height="150"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件">
|
||||
<FileUpload v-model="file" :disabled="isdetail" />
|
||||
<FileUpload v-model="file" :limit="1" :f-name="fileName" :disabled="isdetail" @name="setFileName" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button type="primary" @click="goback()">取消</el-button>
|
||||
<el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
<el-button type="primary" @click="goback()">{{ isdetail ? '关闭' : '取消' }}</el-button>
|
||||
<!-- <el-button v-if="isdetail" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</el-button> -->
|
||||
<el-button v-if="!isdetail" type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
@@ -184,6 +185,7 @@ export default {
|
||||
total: 0,
|
||||
},
|
||||
file: '',
|
||||
fileName: '',
|
||||
dataRule: {
|
||||
responsible: [{ required: true, message: "巡检人不能为空", trigger: "blur" }],
|
||||
actualTime: [{ required: true, message: "巡检时间不能为空", trigger: "blur" }]
|
||||
@@ -194,6 +196,9 @@ export default {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
setFileName(val) {
|
||||
this.fileName = val
|
||||
},
|
||||
async getDict() {
|
||||
const res = await getEquipmentAll()
|
||||
this.eqList = res.data
|
||||
@@ -232,6 +237,8 @@ export default {
|
||||
files: []
|
||||
}
|
||||
this.list = []
|
||||
this.file = ''
|
||||
this.fileName = ''
|
||||
},
|
||||
init(id, isdetail) {
|
||||
this.initData();
|
||||
@@ -239,6 +246,10 @@ export default {
|
||||
this.dataForm.id = id || undefined;
|
||||
this.visible = true;
|
||||
|
||||
// const scrollContainer = this.$refs.dataForm;
|
||||
// const scrollPosition = scrollContainer.scrollTop;
|
||||
// console.log('12', scrollPosition);
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
|
||||
@@ -247,6 +258,11 @@ export default {
|
||||
getEqCheckLog(this.dataForm.id).then(response => {
|
||||
this.formLoading = false
|
||||
this.dataForm = response.data;
|
||||
if (this.dataForm.files.length > 0) {
|
||||
this.file = this.dataForm.files[0].fileUrl
|
||||
this.fileName = this.dataForm.files[0].fileName
|
||||
}
|
||||
this.setConfig()
|
||||
});
|
||||
} else {
|
||||
// if (this.urlOptions.isGetCode) {
|
||||
@@ -283,8 +299,9 @@ export default {
|
||||
if (this.file) {
|
||||
const temp = this.file.split(',') // 获取文件个数
|
||||
let arry = []
|
||||
temp.forEach(item => {
|
||||
temp.forEach((item, index) => {
|
||||
arry.push({
|
||||
fileName: this.fileName,
|
||||
fileType: 2,
|
||||
fileUrl: item
|
||||
})
|
||||
|
||||
@@ -69,7 +69,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
addOrUpdateVisible: false,
|
||||
searchBarKeys: ['equipmentId', 'createTime'],
|
||||
searchBarKeys: ['equipmentId', 'actualTime'],
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('equipment:check-record:detail')
|
||||
? {
|
||||
@@ -105,6 +105,7 @@ export default {
|
||||
label: '设备',
|
||||
placeholder: '请选择设备',
|
||||
param: 'equipmentId',
|
||||
filterable: true
|
||||
},
|
||||
// 开始结束时间
|
||||
{
|
||||
@@ -112,12 +113,12 @@ export default {
|
||||
label: '时间段',
|
||||
dateType: 'daterange', // datetimerange
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'timestamp',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期',
|
||||
defaultTime: ['00:00:00', '23:59:59'],
|
||||
param: 'startTime',
|
||||
param: 'actualTime',
|
||||
// width: 350,
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-09 11:09:26
|
||||
* @LastEditTime: 2023-11-27 10:48:55
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
@@ -52,11 +52,10 @@
|
||||
|
||||
<div v-if="!isdetail" class="action_btn">
|
||||
<template>
|
||||
<span style="display: inline-block;" @click="addNew()">
|
||||
<svg-icon style="width: 14px; height: 14px" class="item-icon" icon-class="table_add" />
|
||||
<span class="add">添加</span>
|
||||
</span>
|
||||
</template>
|
||||
<span style="display: inline-block;">
|
||||
<el-button type="text" @click="addNew()" icon="el-icon-plus">添加</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</div>
|
||||
<base-table
|
||||
:table-props="tableProps"
|
||||
@@ -177,11 +176,7 @@ export default {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'delete') {
|
||||
this.$confirm(
|
||||
`确定对${
|
||||
raw.data.attrName
|
||||
? '[名称=' + raw.data.attrName + ']'
|
||||
: '[序号=' + raw.data._pageIndex + ']'
|
||||
}进行删除操作?`,
|
||||
`是否确认删除巡检项目名称为"${raw.data.program}"的数据项?`,
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
@@ -290,7 +285,7 @@ export default {
|
||||
|
||||
.drawer >>> .visual-part {
|
||||
flex: 1 auto;
|
||||
max-height: 76vh;
|
||||
max-height: 16vh;
|
||||
overflow: hidden;
|
||||
overflow-y: scroll;
|
||||
padding-right: 10px; /* 调整滚动条样式 */
|
||||
@@ -308,7 +303,7 @@ export default {
|
||||
}
|
||||
.action_btn {
|
||||
float: right;
|
||||
margin: 5px 15px;
|
||||
margin: -40px 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.add {
|
||||
|
||||
105
src/views/equipment/base/inspection/Settings/add.vue
Normal file
105
src/views/equipment/base/inspection/Settings/add.vue
Normal file
@@ -0,0 +1,105 @@
|
||||
<!--
|
||||
* @Author: zwq
|
||||
* @Date: 2021-11-18 14:16:25
|
||||
* @LastEditors: DY
|
||||
* @LastEditTime: 2023-11-25 16:23:13
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<el-form
|
||||
:model="dataForm"
|
||||
:rules="dataRule"
|
||||
ref="dataForm"
|
||||
@keyup.enter.native="dataFormSubmit()"
|
||||
label-width="80px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="配置名称" prop="name">
|
||||
<el-input
|
||||
v-model="dataForm.name"
|
||||
placeholder="请输入配置名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="配置编码" prop="code">
|
||||
<el-input
|
||||
v-model="dataForm.code"
|
||||
placeholder="请输入配置编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备名称" prop="equipmentId">
|
||||
<el-select
|
||||
v-model="dataForm.equipmentId"
|
||||
filterable
|
||||
style="width: 100%"
|
||||
placeholder="请选择设备名称"
|
||||
@change="setCode">
|
||||
<el-option
|
||||
v-for="dict in eqList"
|
||||
:key="dict.id"
|
||||
:label="dict.name"
|
||||
:value="dict.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="设备编码" prop="equipmentCode">
|
||||
<el-input v-model="dataForm.equipmentCode" disabled placeholder="请输入设备编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import basicAdd from '../../../../core/mixins/basic-add';
|
||||
import { getEqCheck, getCode, createCheckConfig, updateCheckConfig } from "@/api/equipment/base/inspection/settings";
|
||||
import { getEquipmentAll } from '@/api/base/equipment'
|
||||
|
||||
export default {
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
urlOptions: {
|
||||
isGetCode: true,
|
||||
codeURL: getCode,
|
||||
createURL: createCheckConfig,
|
||||
updateURL: updateCheckConfig,
|
||||
infoURL: getEqCheck,
|
||||
},
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
code: undefined,
|
||||
name: undefined,
|
||||
equipmentId: undefined,
|
||||
equipmentCode: undefined
|
||||
},
|
||||
eqList: [],
|
||||
dataRule: {
|
||||
equipmentId: [{ required: true, message: "设备不能为空", trigger: "blur" }],
|
||||
code: [{ required: true, message: "配置编码不能为空", trigger: "blur" }],
|
||||
name: [{ required: true, message: "配置名称不能为空", trigger: "blur" }],
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getDict()
|
||||
},
|
||||
methods: {
|
||||
async getDict() {
|
||||
// 设备列表
|
||||
const res = await getEquipmentAll()
|
||||
this.eqList = res.data
|
||||
},
|
||||
setCode() {
|
||||
const chooseM = this.eqList.filter(item => {
|
||||
return item.id === this.dataForm.equipmentId
|
||||
})
|
||||
this.dataForm.equipmentCode = chooseM[0].code
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -36,14 +36,10 @@
|
||||
:dialogVisible="open"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
<DialogForm
|
||||
v-if="open"
|
||||
ref="form"
|
||||
v-model="form"
|
||||
:disabled="mode == 'detail'"
|
||||
:has-files="false"
|
||||
:rows="rows" />
|
||||
@confirm="handleConfirm">
|
||||
<add
|
||||
ref="add"
|
||||
@refreshDataList="successSubmit" />
|
||||
</base-dialog>
|
||||
<!-- 添加巡检,查看详情 -->
|
||||
<addOrUpdata
|
||||
@@ -54,15 +50,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import addOrUpdata from './add-or-updata.vue';
|
||||
import add from './add.vue'
|
||||
// import { publicFormatter } from '@/utils/dict';
|
||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
export default {
|
||||
name: 'EquipmentCheckSetting',
|
||||
components: { addOrUpdata },
|
||||
components: { addOrUpdata, add },
|
||||
mixins: [basicPageMixin],
|
||||
data() {
|
||||
return {
|
||||
@@ -101,9 +97,9 @@ export default {
|
||||
{ prop: 'lineName', label: '产线' },
|
||||
{ prop: 'sectionName', label: '工段' },
|
||||
{ prop: 'equipmentName', label: '设备' },
|
||||
{ prop: 'responsible', label: '负责人' },
|
||||
{ prop: 'equipmentCode', label: '描述' },
|
||||
{ prop: 'checkNumber', label: '巡检条数' } // TODO: 操作 选项,四个,群里询问
|
||||
{ prop: 'equipmentCode', label: '设备编码' },
|
||||
// { prop: 'responsible', label: '负责人' },
|
||||
{ prop: 'checkNumber', label: '巡检条数' }, // TODO: 操作 选项,四个,群里询问
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
@@ -117,6 +113,7 @@ export default {
|
||||
label: '设备名称',
|
||||
placeholder: '请选择设备',
|
||||
param: 'equipmentId',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@@ -151,14 +148,18 @@ export default {
|
||||
input: true,
|
||||
label: '配置名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '配置编码',
|
||||
prop: 'code',
|
||||
url: '/base/equipment-check-config/getCode',
|
||||
rules: [{ required: true, message: '配置编码不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '配置编码不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -167,7 +168,13 @@ export default {
|
||||
label: '设备名称',
|
||||
prop: 'equipmentId',
|
||||
url: '/base/core-equipment/listAll',
|
||||
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
bind: {
|
||||
filterable: true,
|
||||
clearable: true,
|
||||
},
|
||||
rules: [
|
||||
{ required: true, message: '设备名称不能为空', trigger: 'change' },
|
||||
],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
@@ -196,6 +203,13 @@ export default {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
handleConfirm() {
|
||||
this.$refs.add.dataFormSubmit()
|
||||
},
|
||||
successSubmit() {
|
||||
this.cancel()
|
||||
this.getList()
|
||||
},
|
||||
initSearchBar() {
|
||||
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
|
||||
this.$set(
|
||||
@@ -220,9 +234,10 @@ export default {
|
||||
},
|
||||
/** 取消按钮 */
|
||||
cancel() {
|
||||
this.$refs.add.formClear()
|
||||
this.open = false;
|
||||
this.mode = null;
|
||||
this.reset();
|
||||
this.title = ''
|
||||
// this.reset();
|
||||
},
|
||||
/** 表单重置 */
|
||||
reset() {
|
||||
@@ -247,18 +262,26 @@ export default {
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
// this.reset();
|
||||
this.open = true;
|
||||
this.title = '添加巡检设置';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.add.init();
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const id = row.id;
|
||||
this.info({ id }).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = '修改巡检设置';
|
||||
// this.reset();
|
||||
// const id = row.id;
|
||||
// this.info({ id }).then((response) => {
|
||||
// this.form = response.data;
|
||||
// this.open = true;
|
||||
// this.title = '修改巡检设置';
|
||||
// });
|
||||
this.open = true;
|
||||
this.title = '修改巡检设置';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.add.init(row.id);
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
@@ -288,9 +311,9 @@ export default {
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否确认删除记录"' + row.name + '"?')
|
||||
.then(function () {
|
||||
return this.delete({ id });
|
||||
.confirm('是否确认删除配置名为"' + row.name + '"的数据项?')
|
||||
.then(() => {
|
||||
return this.del({ id });
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
@@ -317,14 +340,14 @@ export default {
|
||||
},
|
||||
handleDetail({ id }) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = "详情";
|
||||
this.addOrEditTitle = '详情';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id, true);
|
||||
});
|
||||
},
|
||||
handleAddDetail({ id }) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.addOrEditTitle = "添加巡检";
|
||||
this.addOrEditTitle = '添加巡检';
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
});
|
||||
|
||||
@@ -52,6 +52,7 @@ import { publicFormatter } from '@/utils/dict';
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import { exportMaintainMonitorExcel } from '@/api/equipment/base/maintain/record'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
|
||||
const remainBox = {
|
||||
name: 'RemainBox',
|
||||
@@ -99,7 +100,7 @@ const btn = {
|
||||
render: function (h) {
|
||||
return (
|
||||
<el-button type="text" onClick={this.handleClick}>
|
||||
{this.injectData.label}
|
||||
{this.injectData.name}
|
||||
</el-button>
|
||||
);
|
||||
},
|
||||
@@ -113,16 +114,16 @@ export default {
|
||||
return {
|
||||
searchBarKeys: ['planId', 'equipmentId'],
|
||||
tableProps: [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
fixed: true,
|
||||
width: 180,
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
},
|
||||
// {
|
||||
// prop: 'createTime',
|
||||
// label: '添加时间',
|
||||
// fixed: true,
|
||||
// width: 180,
|
||||
// filter: parseTime(createTime),
|
||||
// },
|
||||
{ prop: 'name', label: '保养计划' },
|
||||
{ prop: 'lineName', label: '产线' },
|
||||
{ prop: 'sectionName', label: '工段' },
|
||||
{ prop: 'lineName', label: '产线名' },
|
||||
{ prop: 'sectionName', label: '工段名' },
|
||||
{ prop: 'equipmentName', label: '设备名称' },
|
||||
{ prop: 'equipmentCode', label: '设备编码' },
|
||||
{ prop: 'maintenancePeriod', label: '保养频率' },
|
||||
@@ -134,16 +135,16 @@ export default {
|
||||
{
|
||||
prop: 'lastMaintainTime',
|
||||
label: '上次保养时间',
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
filter: parseTime,
|
||||
},
|
||||
{ prop: 'nextMaintainTime', label: '计划下次保养时间' },
|
||||
{ prop: 'nextMaintainTime', label: '计划下次保养时间', filter: parseTime },
|
||||
{
|
||||
prop: 'remainDays',
|
||||
label: '距离保养时间(天)',
|
||||
subcomponent: remainBox,
|
||||
},
|
||||
{ prop: 'opt1', label: '设备保养', subcomponent: btn },
|
||||
{ prop: 'opt2', label: '保养记录', subcomponent: btn },
|
||||
{ prop: 'opt1', label: '设备保养', name: '操作', subcomponent: btn },
|
||||
{ prop: 'opt2', label: '保养记录', name: '查看详情', subcomponent: btn },
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
@@ -243,15 +244,16 @@ export default {
|
||||
switch (action) {
|
||||
// 查看详情
|
||||
case '设备保养':
|
||||
this.$router.push({ path: '/equipment/base/maintain/plan-config',query: {
|
||||
equipmentId: value.equipmentId,
|
||||
equipmentName: value.equipmentName
|
||||
this.$router.push({ path: '/equipment/base/maintain/record',query: {
|
||||
addRecord: 1,
|
||||
row: value
|
||||
} })
|
||||
break;
|
||||
case '保养记录':
|
||||
const queryData = {
|
||||
equipmentId: value.equipmentId,
|
||||
maintainPlanId: value.id
|
||||
maintainPlanId: value.id,
|
||||
relatePlan: value.lastMaintainTime ? 1 : 2
|
||||
}
|
||||
this.$router.push({ path: '/equipment/base/maintain/record',query: queryData })
|
||||
break;
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record'
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
|
||||
export default {
|
||||
name: 'PlanConfig',
|
||||
@@ -95,7 +96,7 @@ export default {
|
||||
{ prop: 'equipmentName', label: '设备名称' },
|
||||
{ prop: 'maintainDuration', label: '计划保养用时(h)' },
|
||||
{ prop: 'maintenancePeriod', label: '保养频率(天/次)' },
|
||||
{ prop: 'maintainType', label: '保养类型' },
|
||||
{ prop: 'maintainType', label: '保养类型', filter: publicFormatter('maintain_type') },
|
||||
{ prop: 'remark', label: '备注' },
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
@@ -106,37 +107,37 @@ export default {
|
||||
param: 'equipmentName',
|
||||
},
|
||||
// 时间段
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间段',
|
||||
dateType: 'daterange', // datetimerange
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
// valueFormat: 'timestamp',
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始日期',
|
||||
endPlaceholder: '结束日期',
|
||||
defaultTime: ['00:00:00', '23:59:59'],
|
||||
param: 'createTime',
|
||||
// defaultSelect: [
|
||||
// new Date(y, m, d)
|
||||
// .toLocaleString()
|
||||
// .split('/')
|
||||
// .map((item, index) => {
|
||||
// if (index == 1 || index == 2) return item.padStart(2, '0');
|
||||
// return item;
|
||||
// })
|
||||
// .join('-'),
|
||||
// new Date(y, m, d, 23, 59, 59)
|
||||
// .toLocaleString()
|
||||
// .split('/')
|
||||
// .map((item, index) => {
|
||||
// if (index == 1 || index == 2) return item.padStart(2, '0');
|
||||
// return item;
|
||||
// })
|
||||
// .join('-'),
|
||||
// ],
|
||||
},
|
||||
// {
|
||||
// type: 'datePicker',
|
||||
// label: '时间段',
|
||||
// dateType: 'daterange', // datetimerange
|
||||
// format: 'yyyy-MM-dd',
|
||||
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
// // valueFormat: 'timestamp',
|
||||
// rangeSeparator: '-',
|
||||
// startPlaceholder: '开始日期',
|
||||
// endPlaceholder: '结束日期',
|
||||
// defaultTime: ['00:00:00', '23:59:59'],
|
||||
// param: 'createTime',
|
||||
// // defaultSelect: [
|
||||
// // new Date(y, m, d)
|
||||
// // .toLocaleString()
|
||||
// // .split('/')
|
||||
// // .map((item, index) => {
|
||||
// // if (index == 1 || index == 2) return item.padStart(2, '0');
|
||||
// // return item;
|
||||
// // })
|
||||
// // .join('-'),
|
||||
// // new Date(y, m, d, 23, 59, 59)
|
||||
// // .toLocaleString()
|
||||
// // .split('/')
|
||||
// // .map((item, index) => {
|
||||
// // if (index == 1 || index == 2) return item.padStart(2, '0');
|
||||
// // return item;
|
||||
// // })
|
||||
// // .join('-'),
|
||||
// // ],
|
||||
// },
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
@@ -224,6 +225,17 @@ export default {
|
||||
rules: [{ required: true, message: '保养频率不能为空', trigger: 'blur' }],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
switch: true,
|
||||
label: '启用状态',
|
||||
prop: 'enabled',
|
||||
bind: {
|
||||
'active-value': 1,
|
||||
'inactive-value': 0,
|
||||
},
|
||||
}
|
||||
],
|
||||
[{ input: true, label: '备注', prop: 'remark' }],
|
||||
],
|
||||
// 是否显示弹出层
|
||||
@@ -300,7 +312,8 @@ export default {
|
||||
const queryData = {
|
||||
equipmentId: row.equipmentId,
|
||||
maintainPlanId: row.id,
|
||||
relatePlan: row.enabled
|
||||
isAdd: 1
|
||||
// relatePlan: row.enabled
|
||||
}
|
||||
if (this.queryParams.createTime) {
|
||||
queryData.createTime = this.queryParams.createTime
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
:disabled="mode == 'detail'"
|
||||
:has-files="true"
|
||||
: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>
|
||||
</div>
|
||||
</template>
|
||||
@@ -53,7 +58,7 @@
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import Editor from '@/components/Editor';
|
||||
import { deleteEqMaintainLog } from '@/api/equipment/base/maintain/record';
|
||||
import { deleteEqMaintainLog, exportMaintainLogExcel } from '@/api/equipment/base/maintain/record';
|
||||
|
||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
@@ -121,14 +126,14 @@ export default {
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: '保养计划',
|
||||
placeholder: '请选择保养计划',
|
||||
label: '计划名称',
|
||||
placeholder: '请选择计划名称',
|
||||
param: 'maintainPlanId',
|
||||
},
|
||||
// 开始结束时间
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间段',
|
||||
label: '保养开始时间',
|
||||
dateType: 'daterange', // datetimerange
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: 'yyyy-MM-dd HH:mm:ss',
|
||||
@@ -311,13 +316,16 @@ export default {
|
||||
this.searchBarFormConfig[0].defaultSelect =
|
||||
this.$route.query.equipmentId ?? undefined;
|
||||
this.searchBarFormConfig[1].defaultSelect =
|
||||
Number(this.$route.query.maintainPlanId) ?? undefined;
|
||||
this.$route.query.maintainPlanId ?? undefined;
|
||||
this.searchBarFormConfig[2].defaultSelect =
|
||||
this.$route.query?.createTime ?? undefined;
|
||||
this.searchBarFormConfig[3].defaultSelect =
|
||||
Number(this.$route.query.relatePlan) ?? undefined;
|
||||
}
|
||||
this.getList();
|
||||
if (this.$route.query.addRecord) {
|
||||
this.handleAdd()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initSearchBar() {
|
||||
@@ -398,6 +406,19 @@ export default {
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
if (this.$route.query.addRecord) {
|
||||
// 赋值
|
||||
const tempRow = this.$route.query.row
|
||||
this.form.equipmentId = tempRow.equipmentId
|
||||
this.form.relatePlan = tempRow.nextMaintainTime ? 1 : 2
|
||||
this.form.startTime = tempRow.nextMaintainTime
|
||||
this.form.maintainPlanId = tempRow.id
|
||||
}
|
||||
if (this.$route.query.isAdd) {
|
||||
// 赋值
|
||||
this.form.equipmentId = this.$route.query.equipmentId
|
||||
this.form.maintainPlanId = this.$route.query.maintainPlanId
|
||||
}
|
||||
this.open = true;
|
||||
this.title = '添加保养记录';
|
||||
},
|
||||
@@ -440,7 +461,7 @@ export default {
|
||||
handleDelete(row) {
|
||||
const id = row.id;
|
||||
this.$modal
|
||||
.confirm('是否删除设备名称为"' + row.equipmentName + '"的数据项?')
|
||||
.confirm('是否确认删除设备名称为"' + row.equipmentName + '"的数据项?')
|
||||
.then(function () {
|
||||
return deleteEqMaintainLog(id);
|
||||
})
|
||||
@@ -456,7 +477,7 @@ export default {
|
||||
this.info({ id }).then((response) => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = '修改保养记录';
|
||||
this.title = '查看保养记录详情';
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
@@ -469,10 +490,10 @@ export default {
|
||||
.confirm('是否确认导出所有保养记录?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportEquipmentTypeExcel(params);
|
||||
return exportMaintainLogExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '保养记录.xls');
|
||||
this.$download.excel(response, '设备保养记录.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="故障发生时间" prop="faultTime">
|
||||
<span>{{ dataForm.faultTime }}</span>
|
||||
<span>{{ parseTime(dataForm.faultTime) }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<el-form-item label="故障级别" prop="faultLevel">
|
||||
<span>{{ dataForm.faultLevel }}</span>
|
||||
<span>{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -146,7 +146,7 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col>
|
||||
<el-form-item label="维修附件" prop="file">
|
||||
<FileUpload v-model="file" :disabled="disabled" />
|
||||
<FileUpload v-model="file" :limit="1" :f-name="fileName" :disabled="disabled" @name="setFileName" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -164,11 +164,11 @@
|
||||
</el-form>
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button style="" @click="goback()">取消</el-button>
|
||||
<el-button v-if="disabled" type="primary" @click="goEdit()">
|
||||
<el-button style="" @click="goback()">{{ disabled ? '返回' : '取消' }}</el-button>
|
||||
<!-- <el-button v-if="disabled" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button v-else type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</el-button> -->
|
||||
<el-button v-if="!disabled" type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
@@ -179,6 +179,8 @@ import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair'
|
||||
import Editor from "@/components/Editor";
|
||||
import FileUpload from "@/components/FileUpload";
|
||||
import { getDictDatas } from "@/utils/dict";
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
import { getDictDataLabel } from '@/utils/dict';
|
||||
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
@@ -204,11 +206,15 @@ export default {
|
||||
visible: false,
|
||||
disabled: false,
|
||||
dataForm: {},
|
||||
file: ''
|
||||
file: '',
|
||||
fileName: ''
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
setFileName(val) {
|
||||
this.fileName = val
|
||||
},
|
||||
goback() {
|
||||
this.$emit('refreshDataList');
|
||||
this.visible = false;
|
||||
@@ -223,12 +229,15 @@ export default {
|
||||
resetFields(args) {
|
||||
return this.$refs.form.resetFields(args);
|
||||
},
|
||||
initData() {
|
||||
this.file = ''
|
||||
this.fileName = ''
|
||||
},
|
||||
init(row, isdetail) {
|
||||
// this.initData();
|
||||
this.initData();
|
||||
this.disabled = isdetail || false;
|
||||
this.dataForm.id = row.id || undefined;
|
||||
this.visible = true;
|
||||
console.log('111', this.dataForm, row)
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.$refs['form'].resetFields();
|
||||
@@ -239,6 +248,10 @@ export default {
|
||||
this.formLoading = false
|
||||
this.dataForm = response.data;
|
||||
this.dataForm.maintenanceStatus = row.maintenanceStatus || 0
|
||||
if (this.dataForm.files.length > 0) {
|
||||
this.file = this.dataForm.files[0].fileUrl
|
||||
this.fileName = this.dataForm.files[0].fileName
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// if (this.urlOptions.isGetCode) {
|
||||
@@ -259,6 +272,7 @@ export default {
|
||||
let arry = []
|
||||
temp.forEach(item => {
|
||||
arry.push({
|
||||
fileName: this.fileName,
|
||||
fileType: 2,
|
||||
fileUrl: item
|
||||
})
|
||||
|
||||
@@ -53,12 +53,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import moment from 'moment';
|
||||
// import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import CustomDialogForm from './CustomDialogForm.vue';
|
||||
import { deleteRepair } from '@/api/equipment/base/repair'
|
||||
|
||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
import { deleteRepair, exportRepairLogExcel } from '@/api/equipment/base/repair'
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
export default {
|
||||
name: 'EquipmentRepair',
|
||||
@@ -100,14 +100,14 @@ export default {
|
||||
label: '添加时间',
|
||||
fixed: true,
|
||||
width: 180,
|
||||
filter: timeFilter,
|
||||
filter: parseTime,
|
||||
},
|
||||
{ prop: 'repairOrderNumber', label: '设备维修单号' },
|
||||
{ prop: 'maintenanceStartTime', label: '开始时间', filter: timeFilter },
|
||||
{ prop: 'maintenanceStartTime', label: '开始时间', filter: parseTime },
|
||||
{
|
||||
prop: 'maintenanceFinishTime',
|
||||
label: '结束时间',
|
||||
filter: timeFilter,
|
||||
filter: parseTime,
|
||||
},
|
||||
{
|
||||
prop: 'maintenanceStatus',
|
||||
@@ -129,6 +129,7 @@ export default {
|
||||
label: '设备',
|
||||
placeholder: '请选择设备',
|
||||
param: 'equipmentId',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
@@ -417,10 +418,10 @@ export default {
|
||||
.confirm('是否确认导出所有维修记录?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return exportEquipmentTypeExcel(params);
|
||||
return exportRepairLogExcel(params);
|
||||
})
|
||||
.then((response) => {
|
||||
this.$download.excel(response, '维修记录.xls');
|
||||
this.$download.excel(response, '设备维修.xls');
|
||||
this.exportLoading = false;
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
@@ -75,9 +75,6 @@
|
||||
|
||||
<div class="drawer-body__footer">
|
||||
<el-button type="primary" @click="goback()">关闭</el-button>
|
||||
<el-button v-if="disabled" type="primary" @click="goEdit()">
|
||||
编辑
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<attr-add
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
</el-form>
|
||||
|
||||
<el-row style="text-align: right">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
@@ -79,21 +79,13 @@ export default {
|
||||
this.partList = res.data.list;
|
||||
})
|
||||
},
|
||||
cancel() {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.visible = false
|
||||
},
|
||||
init(id) {
|
||||
this.dataForm.id = id || '';
|
||||
// this.dataForm.id = id || '';
|
||||
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() {
|
||||
@@ -117,6 +109,7 @@ export default {
|
||||
configId: this.configId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
|
||||
36
src/views/equipment/base/spareParts/Config/htmls.vue
Normal file
36
src/views/equipment/base/spareParts/Config/htmls.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<!--
|
||||
* @Author: zhp
|
||||
* @Date: 2023-11-08 14:00:52
|
||||
* @LastEditTime: 2023-11-24 09:12:36
|
||||
* @LastEditors: DY
|
||||
* @Description:
|
||||
-->
|
||||
<template>
|
||||
<div v-html="content" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
injectData: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
content: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getContent()
|
||||
console.log('12', this.injectData)
|
||||
},
|
||||
|
||||
methods: {
|
||||
getContent() {
|
||||
this.content = this.injectData.description ?? ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -60,8 +60,9 @@ import { publicFormatter } from '@/utils/dict';
|
||||
import Editor from '@/components/Editor';
|
||||
import addSparts from './addSparts.vue';
|
||||
import { deleteConfig } from '@/api/equipment/base/spare-parts/config'
|
||||
import htmls from './htmls.vue'
|
||||
|
||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
export default {
|
||||
name: 'EquipmentSparePartsConfig',
|
||||
@@ -111,7 +112,7 @@ export default {
|
||||
{ prop: 'equipmentCode', label: '设备编码' },
|
||||
{ prop: 'responsible', label: '负责人' },
|
||||
// { prop: 'unit', label: '单位', filter: publicFormatter('unit_dict') },
|
||||
{ prop: 'description', label: '描述' },
|
||||
{ prop: 'description', label: '描述', subcomponent: htmls },
|
||||
{ prop: 'sparePartNumber', label: '备品备件数量' },
|
||||
// { prop: 'remark', label: '备注' },
|
||||
],
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import { deleteSparePart } from '@/api/equipment/base/spare-parts/list'
|
||||
import { deleteSparePart } from '@/api/equipment/base/spare-parts/list';
|
||||
|
||||
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
|
||||
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
searchBarFormConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '关键字',
|
||||
label: '备件名称',
|
||||
placeholder: '请输入备件名称',
|
||||
param: 'name',
|
||||
},
|
||||
@@ -132,20 +132,33 @@ export default {
|
||||
input: true,
|
||||
label: '备件名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '备件名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '备件名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '备件型号',
|
||||
prop: 'model',
|
||||
label: '备件编码',
|
||||
prop: 'code',
|
||||
url: '/base/equipment-spare-part/getCode',
|
||||
rules: [
|
||||
{ required: true, message: '备件编码不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '备件型号',
|
||||
prop: 'model',
|
||||
},
|
||||
{
|
||||
input: true,
|
||||
label: '规格',
|
||||
prop: 'specifications',
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '供应商',
|
||||
@@ -155,10 +168,10 @@ export default {
|
||||
filterable: true,
|
||||
clearable: true,
|
||||
},
|
||||
rules: [{ required: true, message: '供应商不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '供应商不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '物料类型',
|
||||
@@ -169,8 +182,12 @@ export default {
|
||||
filterable: true,
|
||||
clearable: true,
|
||||
},
|
||||
rules: [{ required: true, message: '物料类型不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '物料类型不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '使用寿命',
|
||||
@@ -184,14 +201,14 @@ export default {
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
select: true,
|
||||
label: '单位',
|
||||
prop: 'unit', // 数据字典
|
||||
options: this.getDictDatas(this.DICT_TYPE.UNIT_DICT),
|
||||
},
|
||||
],
|
||||
[
|
||||
{
|
||||
input: true,
|
||||
label: '备注',
|
||||
@@ -284,6 +301,12 @@ export default {
|
||||
const id = row.id;
|
||||
this.info({ id }).then((response) => {
|
||||
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.title = '修改备品备件';
|
||||
});
|
||||
|
||||
@@ -310,7 +310,8 @@ export default {
|
||||
handleClick(raw) {
|
||||
if (raw.type === 'change') {
|
||||
// 更换
|
||||
this.addNew();
|
||||
console.log(raw)
|
||||
this.addNew(raw.data.sparePartId);
|
||||
} else {}
|
||||
},
|
||||
getList() {
|
||||
@@ -320,7 +321,7 @@ export default {
|
||||
configId: this.dataForm.id,
|
||||
}).then((response) => {
|
||||
this.list = response.data;
|
||||
this.listQuery.total = response.data.total;
|
||||
this.listQuery.total = response.data.length;
|
||||
});
|
||||
},
|
||||
getList1() {
|
||||
@@ -334,10 +335,10 @@ export default {
|
||||
});
|
||||
},
|
||||
// 新增 / 修改
|
||||
addNew(id) {
|
||||
addNew(sparePartId) {
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
this.$refs.addOrUpdate.init(sparePartId);
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
|
||||
@@ -25,10 +25,27 @@
|
||||
clearable
|
||||
placeholder="请输入操作人" />
|
||||
</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-row style="text-align: right">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
||||
</el-row>
|
||||
</el-dialog>
|
||||
@@ -49,11 +66,15 @@ export default {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
id: undefined,
|
||||
responsible: ''
|
||||
responsible: '',
|
||||
timeUsed: 0,
|
||||
sparePartId: '',
|
||||
replacementTime: undefined
|
||||
},
|
||||
partList: [],
|
||||
dataRule: {
|
||||
responsible: [{ required: true, message: '操作人不能为空', trigger: 'blur' }]
|
||||
responsible: [{ required: true, message: '操作人不能为空', trigger: 'blur' }],
|
||||
replacementTime: [{ required: true, message: '更换时间不能为空', trigger: 'blur' }]
|
||||
},
|
||||
};
|
||||
},
|
||||
@@ -66,9 +87,13 @@ export default {
|
||||
// this.partList = res.data
|
||||
// },
|
||||
init(id) {
|
||||
this.dataForm.id = id || '';
|
||||
this.dataForm.sparePartId = id || undefined;
|
||||
this.visible = true;
|
||||
},
|
||||
cancel() {
|
||||
this.$refs['dataForm'].resetFields();
|
||||
this.visible = false;
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
@@ -91,6 +116,7 @@ export default {
|
||||
configId: this.configId,
|
||||
}).then((response) => {
|
||||
this.$modal.msgSuccess('新增成功');
|
||||
this.$refs['dataForm'].resetFields();
|
||||
this.visible = false;
|
||||
this.$emit('refreshDataList');
|
||||
});
|
||||
|
||||
@@ -72,10 +72,10 @@ const remainBox = {
|
||||
},
|
||||
computed: {
|
||||
value() {
|
||||
const temp = this.injectData[this.injectData.prop] || null
|
||||
const temp = this.injectData[this.injectData.prop] || null;
|
||||
if (temp) {
|
||||
console.log('12', temp)
|
||||
return temp === 'Green' ? 'green' : 'red'
|
||||
console.log('12', temp);
|
||||
return temp === 'Green' ? 'green' : 'red';
|
||||
}
|
||||
return this.injectData[this.injectData.prop] || null;
|
||||
},
|
||||
@@ -83,7 +83,7 @@ const remainBox = {
|
||||
if (this.value) {
|
||||
// const v = +this.value;
|
||||
// return v < 0 ? 'red' : v >= 0 && v < 2 ? 'yellow' : 'green';
|
||||
return this.value
|
||||
return this.value;
|
||||
}
|
||||
return 'unset';
|
||||
},
|
||||
@@ -95,8 +95,7 @@ const remainBox = {
|
||||
this.color
|
||||
// this.color == 'Green' ? 'green' : this.color == 'Red' ? 'red' : 'yellow'
|
||||
}; position:absolute; inset: 0; padding: 0 10px; display: flex; align-items: center; color: ${
|
||||
'unset'
|
||||
// this.color == 'red' ? '#fff' : 'unset'
|
||||
this.color == 'red' || this.color == 'green' ? '#fff' : 'unset'
|
||||
}`}>
|
||||
{this.injectData[this.injectData.prop] || ''}
|
||||
</div>
|
||||
@@ -112,7 +111,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) {
|
||||
@@ -124,8 +126,6 @@ const btn = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
export default {
|
||||
name: 'EquipmentSparePartsMonitor',
|
||||
components: { addSparts },
|
||||
@@ -162,7 +162,12 @@ export default {
|
||||
{ prop: 'responsible', label: '负责人' },
|
||||
{ prop: 'color', label: '是否超期', subcomponent: remainBox },
|
||||
{ prop: 'opt1', label: '备件更换', name: '操作', subcomponent: btn },
|
||||
{ prop: 'opt2', label: '更换记录', name: '更新记录', subcomponent: btn }, // TODO: 是否换成按钮, 群里问
|
||||
{
|
||||
prop: 'opt2',
|
||||
label: '更换记录',
|
||||
name: '更新记录',
|
||||
subcomponent: btn,
|
||||
}, // TODO: 是否换成按钮, 群里问
|
||||
// { prop: 'remark', label: '备注' },
|
||||
],
|
||||
searchBarFormConfig: [
|
||||
@@ -171,12 +176,14 @@ export default {
|
||||
label: '产线',
|
||||
placeholder: '请选择产线',
|
||||
param: 'lineId',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: '设备',
|
||||
placeholder: '请选择设备',
|
||||
param: 'equipmentId',
|
||||
filterable: true,
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
@@ -211,7 +218,9 @@ export default {
|
||||
input: true,
|
||||
label: '配置名称',
|
||||
prop: 'name',
|
||||
rules: [{ required: true, message: '配置名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -224,7 +233,9 @@ export default {
|
||||
filterable: true,
|
||||
clearable: true,
|
||||
},
|
||||
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
rules: [
|
||||
{ required: true, message: '设备名称不能为空', trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -281,29 +292,29 @@ export default {
|
||||
}
|
||||
},
|
||||
eqOperation({ id }) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id);
|
||||
});
|
||||
},
|
||||
updateLog({ id }) {
|
||||
this.addOrUpdateVisible = true
|
||||
this.addOrUpdateVisible = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addOrUpdate.init(id, true);
|
||||
});
|
||||
},
|
||||
initSearchBar() {
|
||||
// 产线列表
|
||||
getCorePLList().then(res => {
|
||||
getCorePLList().then((res) => {
|
||||
this.$set(
|
||||
this.searchBarFormConfig[0],
|
||||
'selectOptions',
|
||||
res.data.map((item) => ({
|
||||
name: item.name,
|
||||
id: item.id
|
||||
id: item.id,
|
||||
}))
|
||||
);
|
||||
})
|
||||
});
|
||||
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
|
||||
this.$set(
|
||||
this.searchBarFormConfig[1],
|
||||
@@ -319,7 +330,11 @@ export default {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
// 执行查询
|
||||
this.http('/base/equipment-spare-part-config/monitor', 'get', this.queryParams).then((response) => {
|
||||
this.http(
|
||||
'/base/equipment-spare-part-config/monitor',
|
||||
'get',
|
||||
this.queryParams
|
||||
).then((response) => {
|
||||
this.list = response.data.list;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
@@ -338,7 +353,7 @@ export default {
|
||||
name: null,
|
||||
equipmentId: null,
|
||||
description: null,
|
||||
responsible: null
|
||||
responsible: null,
|
||||
};
|
||||
this.resetForm('form');
|
||||
},
|
||||
@@ -397,7 +412,7 @@ export default {
|
||||
this.$modal
|
||||
.confirm('是否确认删除记录"' + row.name + '"?')
|
||||
.then(function () {
|
||||
return this.delete({ id });
|
||||
return this.del({ id });
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
|
||||
Reference in New Issue
Block a user