2023-10-20 16:03:40 +08:00
|
|
|
<!--
|
|
|
|
filename: ProcessBomList.vue
|
|
|
|
author: liubin
|
|
|
|
date: 2023-10-20 15:00:58
|
|
|
|
description:
|
|
|
|
-->
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<section class="process-bom">
|
|
|
|
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" />
|
2023-10-20 16:42:28 +08:00
|
|
|
|
2023-11-16 22:00:50 +08:00
|
|
|
<div
|
|
|
|
class="btns"
|
|
|
|
style="
|
2023-10-20 16:42:28 +08:00
|
|
|
text-align: right;
|
|
|
|
position: absolute;
|
|
|
|
top: 20px;
|
|
|
|
right: 20px;
|
|
|
|
display: flex;
|
|
|
|
">
|
2023-11-16 22:00:50 +08:00
|
|
|
<el-button
|
|
|
|
type="primary"
|
|
|
|
plain
|
|
|
|
:disabled="currentDet == null"
|
|
|
|
class="btn-create"
|
|
|
|
@click="handleAddEquipment"
|
|
|
|
icon="el-icon-plus">
|
2023-10-20 16:42:28 +08:00
|
|
|
分配设备
|
|
|
|
</el-button>
|
2023-11-16 22:00:50 +08:00
|
|
|
<el-input
|
|
|
|
icon="el-icon-search"
|
|
|
|
placeholder="搜索"
|
|
|
|
v-model="searchText"
|
|
|
|
style="margin-left: 20px">
|
2023-10-20 16:42:28 +08:00
|
|
|
<i slot="prefix" class="el-input__icon el-icon-search"></i>
|
|
|
|
</el-input>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
2023-11-16 22:00:50 +08:00
|
|
|
<base-table
|
|
|
|
:table-props="tableProps"
|
|
|
|
:page="queryParams.pageNo"
|
|
|
|
:limit="queryParams.pageSize"
|
|
|
|
:table-data="list"
|
2023-10-20 16:42:28 +08:00
|
|
|
@emitFun="handleEmitFun">
|
2023-11-16 22:00:50 +08:00
|
|
|
<method-btn
|
|
|
|
v-if="tableBtn.length"
|
|
|
|
slot="handleBtn"
|
|
|
|
label="操作"
|
|
|
|
:width="120"
|
|
|
|
:method-list="tableBtn"
|
2023-10-20 16:42:28 +08:00
|
|
|
@clickBtn="handleTableBtnClick" />
|
|
|
|
</base-table>
|
|
|
|
|
|
|
|
<!-- 分页组件 -->
|
2023-11-16 22:00:50 +08:00
|
|
|
<pagination
|
|
|
|
v-show="total > 0"
|
|
|
|
:total="total"
|
|
|
|
:page.sync="queryParams.pageNo"
|
|
|
|
:limit.sync="queryParams.pageSize"
|
2023-10-20 16:42:28 +08:00
|
|
|
@pagination="getList" />
|
2023-11-16 22:00:50 +08:00
|
|
|
|
|
|
|
<base-dialog
|
|
|
|
dialogTitle="选择设备"
|
|
|
|
:dialogVisible="open"
|
2023-11-17 16:48:00 +08:00
|
|
|
width="45%"
|
2023-11-16 22:00:50 +08:00
|
|
|
@close="cancel"
|
|
|
|
@cancel="cancel"
|
|
|
|
@confirm="submitForm">
|
2023-11-17 16:48:00 +08:00
|
|
|
<!-- <CustomTransfer /> -->
|
|
|
|
<BomSelector />
|
2023-11-16 22:00:50 +08:00
|
|
|
</base-dialog>
|
2023-10-20 16:03:40 +08:00
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-11-17 11:15:18 +08:00
|
|
|
import CustomTransfer from './CustomTransfer.vue';
|
2023-11-17 16:48:00 +08:00
|
|
|
import BomSelector from './BomSelector.vue';
|
2023-11-17 11:15:18 +08:00
|
|
|
|
2023-10-20 16:03:40 +08:00
|
|
|
export default {
|
|
|
|
name: 'ProcessBom',
|
2023-11-17 16:48:00 +08:00
|
|
|
components: { BomSelector },
|
2023-10-25 17:02:43 +08:00
|
|
|
props: {
|
|
|
|
currentDet: {
|
|
|
|
type: Object,
|
2023-11-16 22:00:50 +08:00
|
|
|
default: null,
|
|
|
|
},
|
2023-10-25 17:02:43 +08:00
|
|
|
},
|
2023-10-20 16:03:40 +08:00
|
|
|
data() {
|
|
|
|
return {
|
2023-11-16 22:00:50 +08:00
|
|
|
open: false,
|
|
|
|
eqList: [],
|
|
|
|
finalList: [],
|
|
|
|
choosedEquipments: [],
|
2023-10-20 16:03:40 +08:00
|
|
|
searchBarFormConfig: [{ label: '工序下设备' }],
|
2023-10-20 16:42:28 +08:00
|
|
|
tableProps: [
|
2023-11-16 22:00:50 +08:00
|
|
|
{ prop: 'equipmentId', label: '设备名称' },
|
|
|
|
{ prop: 'materialName', label: '物料BOM' },
|
|
|
|
{ prop: 'valueName', label: '参数BOM' },
|
2023-10-20 16:42:28 +08:00
|
|
|
],
|
|
|
|
list: [],
|
|
|
|
total: 0,
|
|
|
|
tableBtn: [],
|
|
|
|
queryParams: {
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
},
|
2023-11-17 11:15:18 +08:00
|
|
|
searchText: '',
|
2023-10-20 16:03:40 +08:00
|
|
|
};
|
|
|
|
},
|
2023-10-25 17:02:43 +08:00
|
|
|
watch: {
|
|
|
|
currentDet: {
|
|
|
|
handler(val) {
|
|
|
|
if (val != null) {
|
|
|
|
this.getList(val);
|
|
|
|
} else {
|
|
|
|
this.clearList();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
immediate: true,
|
2023-11-16 22:00:50 +08:00
|
|
|
deep: true,
|
|
|
|
},
|
2023-10-25 17:02:43 +08:00
|
|
|
},
|
2023-10-20 16:42:28 +08:00
|
|
|
methods: {
|
2023-11-16 22:18:45 +08:00
|
|
|
renderFn(h, option) {
|
|
|
|
console.log(option);
|
|
|
|
return <span>1</span>;
|
2023-11-16 22:00:50 +08:00
|
|
|
},
|
|
|
|
async getEqList() {
|
|
|
|
console.log('currentDet', this.currentDet);
|
|
|
|
const { sectionId } = this.currentDet;
|
|
|
|
const { code, data } = await this.http(
|
|
|
|
'base/core-equipment-bind-section/page',
|
|
|
|
'get',
|
|
|
|
{ workshopSectionId: sectionId, pageNo: 1, pageSize: 100 }
|
|
|
|
);
|
|
|
|
if (code == 0) {
|
|
|
|
console.log('workshopSectionId', data);
|
|
|
|
|
|
|
|
// 模拟数据
|
|
|
|
this.eqList = [
|
|
|
|
{ equipmentId: 1, equipmentName: '设备1' },
|
|
|
|
{ equipmentId: 2, equipmentName: '设备2' },
|
|
|
|
{ equipmentId: 3, equipmentName: '设备3' },
|
|
|
|
{ equipmentId: 4, equipmentName: '设备4' },
|
|
|
|
{ equipmentId: 5, equipmentName: '设备5' },
|
|
|
|
{ equipmentId: 6, equipmentName: '设备6' },
|
|
|
|
]; // ].map((item) => ({ label: item.equipmentName, key: item.equipmentId }));
|
|
|
|
|
|
|
|
// 获取参数bom和物料bom
|
2023-11-16 22:18:45 +08:00
|
|
|
// 需调用参数bom接口和 物料bom接口
|
|
|
|
this.finalList = this.eqList.map((item) => {
|
|
|
|
item.sub = [];
|
2023-11-16 22:00:50 +08:00
|
|
|
// key: equipmentId-参数bomId
|
2023-11-16 22:18:45 +08:00
|
|
|
item.sub.push({
|
|
|
|
key: item.equipmentId + '-' + '101',
|
|
|
|
label: '参数bom1',
|
|
|
|
});
|
|
|
|
item.sub.push({
|
|
|
|
key: item.equipmentId + '-' + '201',
|
|
|
|
label: '物料bom1',
|
|
|
|
});
|
|
|
|
|
|
|
|
return item;
|
2023-11-16 22:00:50 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleEmitFun() {},
|
|
|
|
handleTableBtnClick() {},
|
2023-10-25 17:02:43 +08:00
|
|
|
put(payload) {
|
|
|
|
return this.http(this.updateUrl, 'put', payload);
|
|
|
|
},
|
|
|
|
post(payload) {
|
|
|
|
return this.http(this.addUrl, 'post', payload);
|
|
|
|
},
|
|
|
|
recv(payload) {
|
|
|
|
return this.http(this.pageUrl, 'get', payload);
|
|
|
|
},
|
|
|
|
info(payload) {
|
|
|
|
return this.http(this.infoUrl, 'get', payload);
|
|
|
|
},
|
|
|
|
http(url, method, payload) {
|
|
|
|
return this.$axios({
|
|
|
|
url,
|
|
|
|
method,
|
|
|
|
params: method === 'get' ? payload : null,
|
|
|
|
data: method !== 'get' ? payload : null,
|
2023-11-16 22:00:50 +08:00
|
|
|
});
|
2023-10-25 17:02:43 +08:00
|
|
|
},
|
2023-11-16 22:18:45 +08:00
|
|
|
submitForm() {},
|
2023-11-16 22:00:50 +08:00
|
|
|
async getList({ detId, detName, detDesc, flowId, sectionName } = {}) {
|
|
|
|
console.log('get list', detId, detName, flowId);
|
|
|
|
const { data, code } = await this.http(
|
|
|
|
'/extend/process-flow-det-equipment/page',
|
|
|
|
'get',
|
|
|
|
{ flowDetId: detId, ...this.queryParams }
|
|
|
|
);
|
|
|
|
if (code == 0) {
|
|
|
|
this.list = data.list;
|
|
|
|
this.total = data.total;
|
|
|
|
} else {
|
|
|
|
this.list.splice(0);
|
|
|
|
this.total = 0;
|
|
|
|
}
|
2023-10-25 17:02:43 +08:00
|
|
|
},
|
2023-11-16 22:00:50 +08:00
|
|
|
async handleAddEquipment() {
|
|
|
|
this.open = true;
|
|
|
|
await this.getEqList();
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
this.open = false;
|
2023-10-25 17:02:43 +08:00
|
|
|
},
|
|
|
|
clearList() {
|
|
|
|
this.list = [];
|
2023-11-16 22:00:50 +08:00
|
|
|
},
|
2023-10-20 16:42:28 +08:00
|
|
|
},
|
2023-10-20 16:03:40 +08:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.process-bom {
|
2023-10-20 16:42:28 +08:00
|
|
|
position: relative;
|
2023-10-25 17:02:43 +08:00
|
|
|
flex: 1;
|
2023-10-20 16:03:40 +08:00
|
|
|
padding: 12px 20px;
|
|
|
|
background: #fff;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
</style>
|