Commit e11d333b authored by wangdanlei's avatar wangdanlei

器材代用维护

parent b1b546c5
<template>
<div>
<dee-as-com
:lay-config="layConfig"
@searchEvent="search"
/>
<dee-as-com
ref="table"
:lay-config="{
typeName: 'JoExecutePlan',
layKey: 'SubstituteMaintenanceEquipmentTable'
}"
dis-business
:result-data="tableData"
@row-click="onRowClick"
/>
<div class="foot-btn-box">
<el-button type="primary" @click="submitEvent">确认</el-button>
<el-button @click="cancelEvent">取消</el-button>
</div>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
componentName: '器材代用维护',
name: 'SubstituteMaintenanceEquipment',
components: {},
props: {},
data() {
return {
tableData: [],
substituteRowData: {},
rowData: null
}
},
computed: {
layConfig() {
return {
typeName: 'JoExecutePlan',
layKey: 'SubstituteMaintenanceEquipmentSearch'
}
}
},
watch: {},
// 生命周期 - 创建完成(可以访问当前this 实例)
created() {
},
// 生命周期 - 挂载之前
beforeMount() {
},
// 生命周期 - 挂载完成(可以访问 DOM 元素)
mounted() {
},
methods: {
search(data) {
this.substituteRowData = this.$utils.findByNameVnode(this, 'DeeAsPage').rowData
const aoInfo = data.items.length ? data.items[0].value : ''
const params = {
aoInfo,
airModel: this.substituteRowData.airModel,
sorties: this.substituteRowData.serialNo,
itemResCode: this.substituteRowData.itemCode
}
post(`/JoExecutePlan/getCanSubstituteAo`, params).then(res => {
if (res.code === 0) {
this.tableData = res.items
}
})
},
getQueryValue(data, key) {
return data.items.find(item => item.fieldName === key) ? data.items.find(item => item.fieldName === key).value : ''
},
onRowClick(data) {
this.rowData = data.row
},
submitEvent() {
if (!this.rowData) {
this.$utils.showMessageWarning('请点击列表中的其中一行!')
return false
}
const params = {
source: this.substituteRowData,
target: this.rowData
}
post(`/Substitutelink/createSubstituteLink`, params).then(res => {
if (res.code === 0) {
this.$utils.showMessageSuccess('创建成功!')
const obj = [{
'fieldName': 'sourceId',
'operator': 'EQ',
'value': this.substituteRowData.id
}]
this.$utils.findByNameVnode(this, 'DeeAsTable').getData(obj)
this.cancelEvent()
}
})
},
cancelEvent() {
this.$emit('cancel')
}
}
}
</script>
<style lang='scss' scoped>
.foot-btn-box{
display: flex;
justify-content: center;
padding: 20px
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment