<template>
|
<div class="mod-config">
|
<basic-container>
|
<div class="avue-crud">
|
<div style="text-align:right;">
|
<el-button
|
type="text"
|
size="small"
|
icon="el-icon-circle-plus-outline"
|
style="color:#f56c6c;margin-right:10px;"
|
@click="addMaterial()"
|
>添加物料
|
</el-button>
|
</div>
|
<el-table :data="dataList" border v-loading="dataListLoading">
|
<el-table-column
|
prop="partNo"
|
header-align="center"
|
align="center"
|
label="零件号"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="partName"
|
header-align="center"
|
align="center"
|
label="零件名称"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="optaskNo"
|
header-align="center"
|
align="center"
|
label="工单编号"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="quantityRequired"
|
header-align="center"
|
align="center"
|
label="需求数量"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="quantityIssued"
|
header-align="center"
|
align="center"
|
label="已投料数量"
|
>
|
</el-table-column>
|
<el-table-column
|
prop="qpa"
|
header-align="center"
|
align="center"
|
label="单位产出所需数量"
|
>
|
</el-table-column>
|
<el-table-column
|
header-align="center"
|
align="center"
|
label="操作"
|
fixed="right"
|
width="130"
|
>
|
<template slot-scope="scope">
|
<el-button
|
type="text"
|
size="small"
|
icon="el-icon-edit"
|
@click="editMaterial(scope.row, scope.$index)"
|
>修改
|
</el-button>
|
<el-button
|
type="text"
|
style="color:red;"
|
size="small"
|
icon="el-icon-delete"
|
@click="deleteMaterial(scope.row, scope.$index)"
|
>删除
|
</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
</div>
|
|
<!-- 弹窗, 新增 / 修改 -->
|
<EditMaterialDialog
|
:currshowlist.sync="showEditMaterial"
|
:materialObj="materialObj"
|
@refreshOperationMaterialList="refreshOperationMaterialList"
|
/>
|
</basic-container>
|
</div>
|
</template>
|
|
<script>
|
import { mapGetters } from 'vuex'
|
import {
|
getOperationMaterialById,
|
delOperationTaskMaterial
|
} from '../../../api/plan/operationtask'
|
import EditMaterialDialog from './editMaterial.vue'
|
|
export default {
|
props: {
|
operationId: {
|
type: Number,
|
default: 0
|
},
|
routingOperationId: {
|
type: Number,
|
default: 0
|
}
|
},
|
data() {
|
return {
|
dataForm: {
|
key: ''
|
},
|
dataList: [],
|
pageIndex: 1,
|
pageSize: 10,
|
totalPage: 0,
|
dataListLoading: false,
|
addOrUpdateVisible: false,
|
showEditMaterial: false,
|
materialObj: {
|
id: null,
|
opTaskId: null
|
}
|
}
|
},
|
components: { EditMaterialDialog },
|
watch: {
|
routingOperationId: {
|
handler(newValue, oldValue) {
|
this.getDataList(this.operationId)
|
},
|
immediate: true
|
}
|
},
|
computed: {
|
...mapGetters(['permissions'])
|
},
|
methods: {
|
// 获取数据列表
|
getDataList(id) {
|
this.visible = true
|
this.$nextTick(() => {
|
getOperationMaterialById(id).then((response) => {
|
this.dataList = response.data.data
|
})
|
})
|
},
|
refreshOperationMaterialList() {
|
getOperationMaterialById(this.operationId).then((response) => {
|
this.dataList = response.data.data
|
})
|
},
|
// 添加物料
|
addMaterial() {
|
this.materialObj.id = null
|
this.materialObj.opTaskId = this.operationId
|
|
this.showEditMaterial = true
|
},
|
// 编辑物料
|
editMaterial(row, index) {
|
this.materialObj.id = row.id
|
this.materialObj.opTaskId = this.operationId
|
|
this.showEditMaterial = true
|
},
|
// 删除物料
|
deleteMaterial(row, index) {
|
delOperationTaskMaterial(row.id).then((response) => {
|
this.$message.success('删除成功')
|
this.refreshOperationMaterialList()
|
})
|
}
|
}
|
}
|
</script>
|