<template>
|
<div ref="device">
|
<a-modal :title="title" :width="800" :visible="visible" :confirmLoading="confirmLoading" :getContainer="() => this.$refs.device"
|
:okButtonProps="{ props: {disabled: disableSubmit} }" @ok="handleOk" @cancel="handleCancel" cancelText="关闭">
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
<a-row :gutter="24">
|
<!--<a-col :span="24">-->
|
<!--<a-form-item label="设备编号" :labelCol="labelCol" :wrapperCol="wrapperCol">-->
|
<!--<!–<a-input v-decorator="['equipmentId', validatorRules.equipmentId]">–>-->
|
<!--<a-input :disabled='disabled' placeholder="请输入设备编号" v-decorator="['equipmentId', validatorRules.equipmentId]"></a-input>-->
|
<!--</a-form-item>-->
|
<!--</a-col>-->
|
<a-col :span="24">
|
<a-form-item label="报警号" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input placeholder="请输入报警号" v-decorator="['alarmCode', validatorRules.alarmCode]"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-item label="报警内容" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-input placeholder="请输入报警内容" v-decorator="['alarmContent', validatorRules.alarmContent]"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :span='24'>
|
<a-form-item label="驱动类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<!--<a-input v-decorator="['driveType', validatorRules.driveType]"-->
|
<!--/>-->
|
<a-input :disabled='disabled' placeholder="请输入驱动类型" v-decorator="['driveType', validatorRules.driveType]"></a-input>
|
</a-form-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-item label="是否启用" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<!--<j-switch v-model="model.isUse"></j-switch>-->
|
<a-switch v-model="isUse"/>
|
<!--<a-radio-group v-model="model.isUse">-->
|
<!--<a-radio :value="1">-->
|
<!--是-->
|
<!--</a-radio>-->
|
<!--<a-radio :value="2">-->
|
<!--否-->
|
<!--</a-radio>-->
|
<!--</a-radio-group>-->
|
</a-form-item>
|
</a-col>
|
</a-row>
|
</a-form>
|
</a-spin>
|
<!--<device-calend-list-model ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></device-calend-list-model>-->
|
<!--<alarm-manager-equpment ref="deviceRepairListModel" @sendSelectionRows="getDeviceRows"></alarm-manager-equpment>-->
|
</a-modal>
|
</div>
|
</template>
|
|
<script>
|
// import DeviceCalendListModel from './DeviceCalendarListModel'
|
// import AlarmManagerEqupment from './alarmManangerEqupment'
|
import moment from 'moment'
|
import pick from 'lodash.pick'
|
import {
|
getAction,
|
postAction,
|
requestPut,
|
putAction
|
} from '@/api/manage'
|
import {
|
duplicateCheck
|
} from '@/api/api'
|
|
export default {
|
name: 'alarmManagerEdit',
|
components: {},
|
props: {
|
},
|
data() {
|
return {
|
isUse:false,
|
disabled:true,
|
title: '',
|
visible: false,
|
show: false,
|
model: {},
|
checked: false,
|
labelCol: {
|
xs: {
|
span: 24
|
},
|
sm: {
|
span: 4
|
}
|
},
|
wrapperCol: {
|
xs: {
|
span: 24
|
},
|
sm: {
|
span: 18
|
}
|
},
|
confirmLoading: false, form: this.$form.createForm(this),
|
validatorRules: {
|
// shiftId:{
|
// rules: [{
|
// required: true, message: '请选择班制!',
|
// }],
|
// },
|
alarmCode:{
|
rules: [{
|
required: true, message: '请输入报警号!',
|
}],
|
},
|
alarmContent:{
|
rules: [{
|
required: true, message: '请输入报警内容!',
|
}],
|
},
|
},
|
url: {
|
// add: '/mdc/alarmInfo/add',
|
edit: '/mdc/mdcAlarmInfo/edit',
|
//驱动类型
|
initShiftList: '/mdc/mdcequipment/driveTypeSelected',
|
},
|
shiftList: [],
|
shiftSubList: [],
|
disableSubmit: true
|
}
|
},
|
created() {
|
},
|
|
methods: {
|
edit(record) {
|
this.form.resetFields()
|
this.model = Object.assign({}, record)
|
this.visible = true
|
this.$nextTick(() => {
|
this.isUse=record.isUse===0?true:false
|
this.form.setFieldsValue(pick(this.model, 'alarmCode', 'alarmContent','driveType'))
|
})
|
},
|
initShiftList() {
|
getAction(this.url.initShiftList).then((res) => {
|
if (res.success) {
|
this.shiftList = res.result
|
}
|
})
|
},
|
close() {
|
this.$emit('close')
|
this.visible = false
|
this.show = false
|
},
|
handleOk() {
|
const that = this
|
// 触发表单验证
|
this.form.validateFields((err, values) => {
|
if (!err) {
|
that.confirmLoading = true
|
let formData = Object.assign(this.model, values)
|
formData.isUse = this.isUse ? "0" : "-1"
|
let obj
|
if (!this.model.id) {
|
// obj = postAction(this.url.add, formData)
|
} else {
|
obj = requestPut(this.url.edit, formData, {
|
id: this.model.id
|
})
|
}
|
obj.then((res) => {
|
if (res.success) {
|
// that.$message.success("添加成功")
|
that.$notification.success({
|
message:'消息',
|
description:"修改成功"
|
});
|
// that.$message.success(res.message)
|
that.$emit('ok', res.result)
|
} else {
|
// that.$message.warning(res.message)
|
that.$notification.warning({
|
message:'消息',
|
description:res.message
|
});
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
that.close()
|
})
|
}
|
})
|
},
|
handleCancel() {
|
this.close()
|
},
|
}
|
}
|
</script>
|
|
<style scoped lang="less">
|
/deep/ .ant-modal-content{
|
/*background: -moz-linear-gradient(left, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.27) 100%);*/
|
/*background: -webkit-gradient(linear, left left, right right, color-stop(0%, rgba(0, 0, 0, 0.66)), color-stop(100%, rgba(0, 0, 0, 0.4)));*/
|
/*background: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.4) 100%);*/
|
/*background: -o-linear-gradient(left, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.4) 100%);*/
|
/*background: -ms-linear-gradient(left, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.4) 100%);*/
|
/*background: linear-gradient(to right, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.4) 100%);*/
|
/*background-color: #000;*/
|
}
|
/deep/ .ant-modal-close{
|
color: #1191b0;
|
font-size: 24px;
|
}
|
/deep/ .ant-modal-close-x{
|
font-size: 24px;
|
}
|
.ant-btn {
|
padding: 0 10px;
|
margin-left: 3px;
|
}
|
|
.ant-form-item-control {
|
line-height: 0px;
|
}
|
|
/** 主表单行间距 */
|
.ant-form .ant-form-item {
|
margin-bottom: 10px;
|
}
|
|
/** Tab页面行间距 */
|
.ant-tabs-content .ant-form-item {
|
margin-bottom: 0px;
|
}
|
</style>
|