|
@@ -1,16 +1,16 @@
|
|
|
<template>
|
|
|
- <a-spin :spinning="confirmLoading">
|
|
|
- <div class="u-flex-jab">
|
|
|
- <div>
|
|
|
+ <a-spin :spinning="confirmLoading" class="interlock-summary-set">
|
|
|
+ <div class="u-flex-jab top-title">
|
|
|
+ <div class="left">
|
|
|
<a-icon type="arrow-left" @click="goBack"/>
|
|
|
- <span>{{ summaryEditType }}</span>
|
|
|
+ <span>{{ summaryType }}</span>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <a-button @click="goBack">关闭</a-button>
|
|
|
- <a-button @click="submitForm" type="primary">提交</a-button>
|
|
|
+ <a-button @click="goBack" style="margin-right: 10px;font-size: 16px;">关闭</a-button>
|
|
|
+ <a-button @click="handleOk" type="primary">提交</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <j-form-container :disabled="formDisabled">
|
|
|
+ <j-form-container class="content-container">
|
|
|
<a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
|
|
|
<div class="interlock-summary-item">
|
|
|
<div class="interlock-summary-item-title">联锁基本信息</div>
|
|
@@ -38,7 +38,7 @@
|
|
|
<a-form-model-item label="逻辑关系" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ljgx">
|
|
|
<!-- <a-input v-model="model.ljgx" placeholder="请输入逻辑关系"></a-input> -->
|
|
|
<!-- <j-dict-select-tag v-model="model.ljgx" placeholder="请选择操作类型" dictCode="ljgx"/> -->
|
|
|
- <a-auto-complete :data-source="ljgxOptions" v-model="model.ljgx" placeholder="请设置逻辑关系"></a-auto-complete>
|
|
|
+ <a-auto-complete :data-source="ljgxOptions" v-model="model.ljgx" :filter-option="filterOption" placeholder="请设置逻辑关系"></a-auto-complete>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
</a-row>
|
|
@@ -71,7 +71,7 @@
|
|
|
<!-- 仪表状态内容 -->
|
|
|
<span slot="instrumentStatusContent" slot-scope="text, record">
|
|
|
<template v-if="record.instrumentStatusJuge === '3'">
|
|
|
- <span>{{ record.instrumentStatusTag }}</span>
|
|
|
+ {{ (record.instrumentStatusNormalName?record.instrumentStatusNormalName:itSystemDefaultValue.instrumentStatusNormalName)+'('+record.instrumentStatusValue+')' }}
|
|
|
</template>
|
|
|
<template v-if="record.instrumentStatusJuge === '0'">
|
|
|
<span>位号:{{ record.instrumentStatusTag }}</span>
|
|
@@ -98,7 +98,10 @@
|
|
|
<!-- 是否旁路 -->
|
|
|
<span slot="ifBypass" slot-scope="text, record">
|
|
|
<span v-if="record.ifBypass === '1'">{{ record.bypassTag }}</span>
|
|
|
- <span v-if="record.ifBypass === '0'">{{ (record.bypassYesName?record.bypassYesName:itSystemDefaultValue.bypassYesName)+'('+record.bypass+')' }}</span>
|
|
|
+ <!-- 否+正常 -->
|
|
|
+ <span v-if="record.ifBypass === '0' && record.bypass === '0'">{{ (record.bypassYesName?record.bypassYesName:itSystemDefaultValue.bypassYesName)+'('+record.bypass+')' }}</span>
|
|
|
+ <!-- 否+异常 -->
|
|
|
+ <span v-if="record.ifBypass === '0' && record.bypass === '1'">{{ (record.bypassNoName?record.bypassNoName:itSystemDefaultValue.bypassNoName)+'('+record.bypass+')' }}</span>
|
|
|
</span>
|
|
|
<!-- 操作 -->
|
|
|
<span slot="action" slot-scope="text, record, index">
|
|
@@ -169,20 +172,6 @@
|
|
|
components: {
|
|
|
InterlockConditionForm
|
|
|
},
|
|
|
- props: {
|
|
|
- //表单禁用
|
|
|
- disabled: {
|
|
|
- type: Boolean,
|
|
|
- default: false,
|
|
|
- required: false
|
|
|
- },
|
|
|
- addInterlock: {
|
|
|
- type: Object,
|
|
|
- default: function(){
|
|
|
- return {} // 使用工厂函数返回默认值
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
data () {
|
|
|
return {
|
|
|
model:{
|
|
@@ -333,14 +322,14 @@
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- formDisabled(){
|
|
|
- return this.disabled
|
|
|
- },
|
|
|
summaryEditInfo() {
|
|
|
return this.$store.getters.summaryEditInfo
|
|
|
},
|
|
|
- summaryEditType() {
|
|
|
- return this.$store.getters.summaryEditType
|
|
|
+ summaryType() {
|
|
|
+ return this.$store.getters.summaryType
|
|
|
+ },
|
|
|
+ clickSystemNode() {
|
|
|
+ return this.$store.getters.clickSystemNode
|
|
|
},
|
|
|
},
|
|
|
// watch: {
|
|
@@ -348,8 +337,19 @@
|
|
|
// console.log('value', val);
|
|
|
// },
|
|
|
// },
|
|
|
+ mounted(){
|
|
|
+ window.addEventListener('onunload', this.handleRefresh);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ // 一定要在组件销毁前移除事件监听,避免内存泄露
|
|
|
+ window.removeEventListener('onunload', this.handleRefresh);
|
|
|
+ },
|
|
|
created () {
|
|
|
- this.loadData()
|
|
|
+ if(this.summaryType === '编辑'){
|
|
|
+ this.getEditData()
|
|
|
+ } else {
|
|
|
+ this.setAdd()
|
|
|
+ }
|
|
|
this.getTagInfo()
|
|
|
this.initDictData()
|
|
|
// this.getData('0', 'apparatusData')
|
|
@@ -357,9 +357,10 @@
|
|
|
this.modelDefault = JSON.parse(JSON.stringify(this.model));
|
|
|
},
|
|
|
methods: {
|
|
|
- goBack(){
|
|
|
+ handleRefresh(){
|
|
|
+ console.log(1111)
|
|
|
this.$router.go(-1)
|
|
|
- // this.$router.push({path: '/interLock/summary'})
|
|
|
+ // this.$router.replace("*")
|
|
|
},
|
|
|
// 获取逻辑关系字典
|
|
|
initDictData() {
|
|
@@ -393,6 +394,12 @@
|
|
|
this.confirmLoading = false
|
|
|
})
|
|
|
},
|
|
|
+ // 逻辑关系过滤
|
|
|
+ filterOption(input, option) {
|
|
|
+ return (
|
|
|
+ option.componentOptions.children[0].text.toUpperCase().indexOf(input.toUpperCase()) >= 0
|
|
|
+ );
|
|
|
+ },
|
|
|
// 联锁条件弹窗-取消
|
|
|
handleConditionCancel(){
|
|
|
this.conditionVisible = false
|
|
@@ -454,16 +461,16 @@
|
|
|
this.conditionDataSource.splice(index, 1)
|
|
|
},
|
|
|
// 新增联锁-弹窗
|
|
|
- add () {
|
|
|
- if(this.addInterlock && this.addInterlock.interlockType === '1'){
|
|
|
+ setAdd() {
|
|
|
+ if(this.clickSystemNode && this.clickSystemNode.interlockType === '1'){
|
|
|
// 当前是新增-用树选择的装置系统进行赋值
|
|
|
- this.model.interlockApparatusId = this.addInterlock.pid
|
|
|
- this.model.interlockSystemId = this.addInterlock.id
|
|
|
+ this.model.interlockApparatusId = this.clickSystemNode.pid
|
|
|
+ this.model.interlockSystemId = this.clickSystemNode.id
|
|
|
}
|
|
|
this.getZzXtData()
|
|
|
},
|
|
|
// 编辑联锁-弹窗
|
|
|
- loadData() {
|
|
|
+ getEditData() {
|
|
|
var record = this.summaryEditInfo
|
|
|
console.log(record)
|
|
|
// this.model = Object.assign({}, record);
|
|
@@ -476,46 +483,77 @@
|
|
|
this.getZzXtData()
|
|
|
})
|
|
|
},
|
|
|
- submitForm () {
|
|
|
- const that = this;
|
|
|
+ goBack(){
|
|
|
+ this.$router.go(-1)
|
|
|
+ this.$store.commit('SET_SUMMARYEDITINFO', []);
|
|
|
+ // this.$router.push({path: '/interLock/summary'})
|
|
|
+ },
|
|
|
+ handleOk(){
|
|
|
+ var _this = this
|
|
|
// 触发表单验证
|
|
|
- this.$refs.form.validate(valid => {
|
|
|
- if (valid) {
|
|
|
+ this.$refs.form.validate((ok, err) => {
|
|
|
+ if (ok) {
|
|
|
if(this.conditionDataSource.length===0){
|
|
|
this.$message.error('联锁条件未设置')
|
|
|
return false
|
|
|
}
|
|
|
- that.confirmLoading = true;
|
|
|
- let httpurl = '';
|
|
|
- let method = '';
|
|
|
- if(!this.model.id){
|
|
|
- httpurl+=this.url.add;
|
|
|
- method = 'post';
|
|
|
- }else{
|
|
|
- httpurl+=this.url.edit;
|
|
|
- method = 'put';
|
|
|
- }
|
|
|
- // 转换数据
|
|
|
- this.model.interlockDetailAddDTOList = this.conditionDataSource
|
|
|
- // 联锁输出值位号
|
|
|
- this.model.deviceId = this.model.interlockOutValueData[0]
|
|
|
- this.model.moduleName = this.model.interlockOutValueData[1]
|
|
|
- this.model.interlockOutValueTag = (this.model.interlockOutValueData[2].split('&'))[0]
|
|
|
- this.model.interlockOutValue = (this.model.interlockOutValueData[2].split('&'))[1]
|
|
|
- console.log(this.model)
|
|
|
- httpAction(httpurl,this.model,method).then((res)=>{
|
|
|
- if(res.success){
|
|
|
- that.$message.success(res.message);
|
|
|
- that.$emit('ok');
|
|
|
- }else{
|
|
|
- that.$message.warning(res.message);
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- that.confirmLoading = false;
|
|
|
- })
|
|
|
+ _this.$confirm({
|
|
|
+ title: '提示',
|
|
|
+ content: '是否确定提交',
|
|
|
+ okButtonProps: {
|
|
|
+ style: {
|
|
|
+ backgroundColor: '#008cd6',
|
|
|
+ fontSize: '16px',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ cancelButtonProps: {
|
|
|
+ style: {
|
|
|
+ fontSize: '16px',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onOk() {
|
|
|
+ _this.submitForm()
|
|
|
+ },
|
|
|
+ onCancel() {},
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ submitForm () {
|
|
|
+ const that = this;
|
|
|
+ that.confirmLoading = true;
|
|
|
+ let httpurl = '';
|
|
|
+ let method = '';
|
|
|
+ if(!this.model.id){
|
|
|
+ httpurl+=this.url.add;
|
|
|
+ method = 'post';
|
|
|
+ }else{
|
|
|
+ httpurl+=this.url.edit;
|
|
|
+ method = 'put';
|
|
|
+ }
|
|
|
+ // 转换数据
|
|
|
+ this.model.interlockDetailAddDTOList = this.conditionDataSource
|
|
|
+ // 联锁输出值位号
|
|
|
+ if(this.model.interlockOutValueData && this.model.interlockOutValueData.length > 0){
|
|
|
+ this.model.deviceId = this.model.interlockOutValueData[0]
|
|
|
+ this.model.moduleName = this.model.interlockOutValueData[1]
|
|
|
+ this.model.interlockOutValueTag = (this.model.interlockOutValueData[2].split('&'))[0]
|
|
|
+ this.model.interlockOutValue = (this.model.interlockOutValueData[2].split('&'))[1]
|
|
|
+ }
|
|
|
+ console.log(this.model)
|
|
|
+ httpAction(httpurl,this.model,method).then((res)=>{
|
|
|
+ if(res.success){
|
|
|
+ that.$message.success(res.message);
|
|
|
+ this.$router.go(-1)
|
|
|
+ this.$store.commit('SET_SUMMARYEDITINFO', []);
|
|
|
+ // that.$emit('ok');
|
|
|
+ }else{
|
|
|
+ that.$message.warning(res.message);
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ that.confirmLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
// 获取装置/系统/联锁数据--默认获取装置数据-方式一需要方法
|
|
|
// getData(pid, dataName){
|
|
|
// let param = {
|
|
@@ -547,29 +585,55 @@
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="less">
|
|
|
- .interlock-summary-item{
|
|
|
- // box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
|
|
|
- margin-bottom: 12px;
|
|
|
- // border-radius: 4px;
|
|
|
- }
|
|
|
- .interlock-summary-item-title{
|
|
|
- background-color: #F5F7FA;
|
|
|
- line-height: 44px;
|
|
|
- font-size: 16px;
|
|
|
- padding: 0 10px 0 20px;
|
|
|
- margin-bottom: 10px;
|
|
|
- border-bottom: 1px solid #f3f3f3;
|
|
|
- color: #323233;
|
|
|
- font-weight: 600;
|
|
|
- }
|
|
|
- .u-flex-jab{
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
+ .interlock-summary-set{
|
|
|
+ height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ .ant-spin-container{
|
|
|
+ height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ .top-title{
|
|
|
+ padding: 12px 10px 12px 20px;
|
|
|
+ .left{
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 700;
|
|
|
+ color: #323233;
|
|
|
+ line-height: 40px;
|
|
|
+ }
|
|
|
+ .anticon{
|
|
|
+ color: #008cd6;
|
|
|
+ padding-right: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .content-container{
|
|
|
+ height: calc(100% - 64px);
|
|
|
+ background: #fff;
|
|
|
+ overflow: auto;
|
|
|
+ .interlock-summary-item{
|
|
|
+ // box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
|
|
|
+ margin-bottom: 12px;
|
|
|
+ // border-radius: 4px;
|
|
|
+ }
|
|
|
+ .interlock-summary-item-title{
|
|
|
+ background-color: #F5F7FA;
|
|
|
+ line-height: 44px;
|
|
|
+ font-size: 16px;
|
|
|
+ padding: 0 10px 0 20px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ border-bottom: 1px solid #f3f3f3;
|
|
|
+ color: #323233;
|
|
|
+ font-weight: 600;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .u-flex-jab{
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+ .interlock-condition-form{
|
|
|
+ .ant-modal{
|
|
|
+ top: 4px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- // .interlock-condition-form{
|
|
|
- // .ant-modal{
|
|
|
- // top: 4px;
|
|
|
- // }
|
|
|
- // }
|
|
|
</style>
|