Commit 6b462880 authored by xioln's avatar xioln

器材代用实施情况新增

parent 3b5f532b
<template>
<dee-dialog
v-if="visible"
title="新增"
:dialog-visible.sync="visible"
width="80%"
>
<div class="equipment-substitution-add">
<!-- 搜索表单 -->
<header>
<div>
<span>机型:</span>
<el-select v-model="searchForm.planeType" size="mini" plain>
<el-option
v-for="item in modelOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div>
<span>架次:</span>
<el-select v-model="searchForm.sorties" size="mini" plain>
<el-option
v-for="item in sortiesOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</div>
<div>
<span>AO搜索:</span>
<el-input
v-model="searchForm.aoName"
size="mini"
placeholder="ao搜索"
/>
</div>
<div>
<el-button
type="primary"
size="mini"
@click="getData"
>查询</el-button>
<el-button size="mini" @click="reset">重置</el-button>
</div>
</header>
<el-table
v-if="!loading"
ref="mselectionTable"
v-loading="loading"
max-height="250"
border
size="mini"
:data="mselectionTableData"
tooltip-effect="dark"
style="width: 100%"
@selection-change="handleSelectionChange"
>
<!-- <el-table-column type="selection" width="55" /> -->
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column
v-for="item in colums"
:key="item.key"
:prop="item.key"
:label="item.title"
show-overflow-tooltip
align="center"
/>
<el-table-column label="操作" align="center" width="120">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
@click.native.prevent="addRow(scope.row)"
>添加</el-button>
</template>
</el-table-column>
</el-table>
<el-table
v-if="!loading"
v-loading="loading"
max-height="250"
border
size="mini"
:data="determineData"
tooltip-effect="dark"
style="width: 100%"
>
<el-table-column type="index" width="50" label="序号" align="center" />
<el-table-column label="AO号" show-overflow-tooltip align="center">
<template slot-scope="scope">
{{ scope.row.serialNumber }}
</template>
</el-table-column>
<el-table-column label="数量" align="center">
<template slot-scope="scope">
<el-input-number v-model="scope.row.num" :min="0" :max="9999" label="描述文字" />
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="120">
<template slot-scope="scope">
<el-button
size="mini"
type="danger"
@click.native.prevent="deleteRow(scope.$index, determineData)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<footer>
<el-button type="primary" size="medium" @click="save">确定</el-button>
<el-button size="medium" @click="handleClose">取消</el-button>
</footer>
</div>
</dee-dialog>
</template>
<script>
export default {
components: {},
props: {
form: {
type: Object,
default: () => { }
}
},
data() {
return {
visible: false,
loading: false,
colums: [
{
title: 'AO号',
show: true,
key: 'serialNumber',
sortable: true,
minWidth: 100
},
{
title: 'AO名称',
show: true,
key: 'materName',
sortable: true,
minWidth: 100
},
{
title: '版本',
show: true,
key: 'gaceVersion',
sortable: true,
minWidth: 100
},
{
title: '有效架次',
show: true,
key: 'sorties',
sortable: true,
minWidth: 100
},
{
title: '首件检验标识',
show: true,
key: 'firstCheckFlag',
sortable: true,
minWidth: 100
}
],
sortiesOptions: [],
modelOptions: [],
// 表格数据
tableData: [],
selectionData: [],
determineData: [],
searchForm: {
planeType: '',
sorties: '',
aoName: ''
},
rules: {
phoneNum: [{ required: true, message: '该项必填', trigger: 'blur' }]
}
}
},
computed: {
mselectionTableData() {
return this.tableData.filter(p => {
return !this.determineData.includes(p.serialNumber)
})
}
},
watch: {
visible: function(v) {
if (!v) {
this.determineData = []
}
},
'searchForm.planeType': {
immediate: true,
deep: true,
handler(val) {
if (val) {
const params = {
searchItems: {
items: [{ 'fieldName': 'aircraftType.defName', operator: 'EQ', value: val }],
operator: 'AND'
}
}
this.$api.searchApi('AircraftSorties', params)
.then((res) => {
this.sortiesOptions = res.items.content.map((item) => {
item.label = item.defName
item.value = item.defName
return item
})
})
.catch((err) => {
console.error(err)
})
}
}
}
},
created() {
this.init()
},
mounted() {},
methods: {
// 打开弹出框
open() {
this.visible = true
this.searchForm = {
planeType: this.form.airModel,
sorties: this.form.serialNo
}
// this.getData()
},
init() {
this.$api.searchApi('AircraftType', {}).then((res) => {
this.modelOptions = res.items.content.map((item) => {
item.label = item.defName
item.value = item.defName
return item
})
})
.catch((err) => {
console.error(err)
})
},
// 关闭弹框
handleClose() {
this.visible = false
this.searchForm = {
planeType: '',
sorties: '',
aoName: ''
}
this.tableData = []
this.getData()
},
// 重置弹出框
reset() {
this.searchForm = {
planeType: '',
sorties: '',
aoName: ''
}
this.getData()
},
getData() {
this.loading = true
var { planeType, sorties, aoName } = this.searchForm
const params = {
pageFrom: 1,
pageSize: 5,
searchItems: {
items: [],
children: [
{
children: [],
items: [
{
fieldName: 'planeType',
operator: 'EQ',
value: planeType
},
{
fieldName: 'sorties',
operator: 'EQ',
value: sorties
},
{
fieldName: 'serialNumber',
operator: 'LIKE',
value: aoName || ''
}
],
operator: 'AND'
}
],
operator: 'AND'
},
sortItem: [
{
fieldName: 'modifyTime',
sortOrder: 'desc'
}
]
}
this.$api.searchApi('ExtProcessPlan', params)
.then((res) => {
this.tableData = res.items.content
})
.catch((err) => console.log(err))
.finally(() => {
// var implementDocNo = this.$parent.form.implementDocNo
// if (implementDocNo) {
// this.determineData = implementDocNo
// .split('、')
// .map(p => { return p.trim() })
// } else {
// // this.determineData = []
// }
this.$nextTick(() => {
this.loading = false
})
})
},
handleSelectionChange(selection) {
this.selectionData = selection
},
save() {
// this.$parent.form.implementDocNo = this.determineData.join('、')
let total = 0
const nums = this.determineData.map(function(x) {
total += x.num
return `${x.serialNumber}${x.num})`
}).join('、')
if (this.form.kitCount === 0) {
this.visible = false
this.$message({ message: '器材数量不能为0', type: 'warning' })
return
} else if (total !== this.form.kitCount) {
total = 0
this.$message({ message: '器材数量不一致', type: 'warning' })
} else {
this.$emit('add', nums)
this.visible = false
}
},
addRow(row) {
const rows = {
serialNumber: row.serialNumber,
num: 0
}
this.determineData.push(rows)
},
deleteRow(index, rows) {
rows.splice(index, 1)
}
}
}
</script>
<style lang="scss" >
.equipment-substitution-add {
> header {
display: flex;
> div {
display: flex;
align-items: center;
> span {
white-space: nowrap;
}
> div {
margin-right: 15px;
}
}
}
.el-table {
margin-top: 15px;
thead th {
color: #2e2e2e;
font-weight: 700;
font-size: 14px;
padding: 0;
background-color: #f3f6f7;
line-height: 46px !important;
}
}
> footer {
text-align: center;
margin-top: 15px;
}
}
</style>
/**
* @Description: 器材代用实施情况新增
* @author xioln
* @date 2023-10-13
* @FilePath: applications/dee-mes/src/privateComponents/components/AddEquipmentPut/index.vue
*/
<template>
<div class="add-equipmentPut">
<el-button type="primary" :disabled="disabledVal" @click="add">新增</el-button>
<add-dialog ref="addDialog" :form="form" @add="addImplementDocNo" />
</div>
</template>
<script>
import addDialog from './components/dialog.vue'
export default {
componentName: '器材代用实施情况新增',
name: 'AddEquipmentPut',
components: { addDialog },
props: {
form: {
type: Object,
default: () => { }
},
itemObj: {
type: Object,
default: null
}
},
data() {
return {
disabledVal: false
}
},
computed: {},
watch: {
itemObj: {
immediate: true,
deep: true,
handler(v) {
if (v.component.hasOwnProperty('disabled')) {
this.disabledVal = v.component.disabled
}
}
}
},
created() {
// 初始化数据
},
methods: {
add() {
this.$refs.addDialog.open()
},
addImplementDocNo(data) {
this.$emit('input', data)
}
}
}
</script>
<style lang='scss'>
</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