|
|
@@ -40,7 +40,7 @@
|
|
|
</headerTitle>
|
|
|
<ele-pro-table
|
|
|
ref="tableRight"
|
|
|
- :columns="columnsRight"
|
|
|
+ :columns="columns"
|
|
|
:datasource="datasourceRightShow"
|
|
|
:selection.sync="selectionRight"
|
|
|
height="45vh"
|
|
|
@@ -88,44 +88,22 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import {
|
|
|
- getRelatesInformationList,
|
|
|
- unassociated,
|
|
|
- productTieUpMaterial
|
|
|
- } from '@/api/material/product.js';
|
|
|
- import dictMixins from '@/mixins/dictMixins';
|
|
|
- import categorySelect from '@/components/CommomSelect/category-select.vue';
|
|
|
+ import { getBomSubList , saveBomList } from '@/api/technology/version/version.js';
|
|
|
export default {
|
|
|
- mixins: [dictMixins],
|
|
|
- components: { categorySelect },
|
|
|
+ components: { },
|
|
|
data () {
|
|
|
return {
|
|
|
visible: false,
|
|
|
row: {},
|
|
|
- datasource: [],
|
|
|
datasourceShow: [],
|
|
|
datasourceRightShow: [],
|
|
|
- datasourceRight: [],
|
|
|
selectionRight: [],
|
|
|
selection: [],
|
|
|
- whereRight: {},
|
|
|
- where: {},
|
|
|
- type: '',
|
|
|
- idMap: {
|
|
|
- 8: '1678278350275198977',
|
|
|
- 4: '1678277959244431361',
|
|
|
- 5: '1678277781556936705'
|
|
|
- }
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
created () {
|
|
|
- // this.requestDict('类型用途');
|
|
|
},
|
|
|
computed: {
|
|
|
- // catogaryName () {
|
|
|
- // return this.getDictValue('类型用途', this.type);
|
|
|
- // },
|
|
|
- dict () {},
|
|
|
columns () {
|
|
|
return [
|
|
|
{
|
|
|
@@ -134,19 +112,19 @@
|
|
|
},
|
|
|
{
|
|
|
label: '子项编号',
|
|
|
- prop: 'categoryLevelGroupName'
|
|
|
+ prop: 'subCode'
|
|
|
},
|
|
|
{
|
|
|
label: '子项物料编码',
|
|
|
- prop: 'code'
|
|
|
+ prop: 'categoryCode'
|
|
|
},
|
|
|
{
|
|
|
label: '子项物料名称',
|
|
|
- prop: 'name'
|
|
|
+ prop: 'categoryName'
|
|
|
},
|
|
|
{
|
|
|
label: '基本数量',
|
|
|
- prop: 'modelType'
|
|
|
+ prop: 'baseNum'
|
|
|
},
|
|
|
{
|
|
|
label: '单位',
|
|
|
@@ -154,40 +132,11 @@
|
|
|
}
|
|
|
];
|
|
|
},
|
|
|
- columnsRight () {
|
|
|
- return [
|
|
|
- {
|
|
|
- type: 'selection',
|
|
|
- align: 'center'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '子项编号',
|
|
|
- prop: 'categoryLevelGroupName'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '子项物料编码',
|
|
|
- prop: 'code'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '子项物料名称',
|
|
|
- prop: 'name'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '基本数量',
|
|
|
- prop: 'modelType'
|
|
|
- },
|
|
|
- {
|
|
|
- label: '单位',
|
|
|
- prop: 'unit'
|
|
|
- }
|
|
|
- ];
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
open (row) {
|
|
|
this.row = row;
|
|
|
this.getDatasource();
|
|
|
- this.getDatasourceRight();
|
|
|
this.visible = true;
|
|
|
},
|
|
|
cancel () {
|
|
|
@@ -197,17 +146,17 @@
|
|
|
if (!this.datasourceRightShow.length) {
|
|
|
return this.$message.error('请添加关联数据');
|
|
|
}
|
|
|
+ const arr = []
|
|
|
+ this.datasourceRightShow.map(item=>{
|
|
|
+ arr.push(item.bomSubId)
|
|
|
+ })
|
|
|
const params = {
|
|
|
- mainCategoryId: this.row.categoryLevelId,
|
|
|
- mainCategoryLevelRootId: this.row.categoryLevelGroupId,
|
|
|
- materialDetailsPOList: this.datasourceRightShow.map((i) => ({
|
|
|
- ...i,
|
|
|
- categoryLevelRootId: this.type
|
|
|
- }))
|
|
|
+ produceVersionId:this.row.produceVersionId,
|
|
|
+ taskInstanceId:this.row.id,
|
|
|
+ bomSubId: arr
|
|
|
};
|
|
|
- await productTieUpMaterial(params);
|
|
|
+ await saveBomList(params);
|
|
|
this.cancel();
|
|
|
-
|
|
|
this.$message.success('操作成功!');
|
|
|
this.$emit('success');
|
|
|
},
|
|
|
@@ -215,81 +164,42 @@
|
|
|
if (!this.selection.length) {
|
|
|
return this.$message.error('请选择关联数据');
|
|
|
}
|
|
|
- this.datasource = this.datasource.filter((i) =>
|
|
|
- this.selection.find((t) => t.categoryId != i.categoryId)
|
|
|
- );
|
|
|
this.datasourceShow = this.datasourceShow.filter((i) =>
|
|
|
- this.selection.find((t) => t.categoryId != i.categoryId)
|
|
|
+ !this.selection.find((t) => t.bomSubId == i.bomSubId)
|
|
|
);
|
|
|
-
|
|
|
this.datasourceRightShow.push(...this.selection);
|
|
|
- this.datasourceRight.push(...this.selection);
|
|
|
-
|
|
|
this.selection = [];
|
|
|
},
|
|
|
handleCancelConect () {
|
|
|
if (!this.selectionRight.length) {
|
|
|
return this.$message.error('请选择取消关联数据');
|
|
|
}
|
|
|
-
|
|
|
- this.datasourceRight = this.datasourceRight.filter((i) =>
|
|
|
- this.selectionRight.find((t) => t.categoryId != i.categoryId)
|
|
|
- );
|
|
|
this.datasourceRightShow = this.datasourceRightShow.filter((i) =>
|
|
|
- this.selectionRight.find((t) => t.categoryId != i.categoryId)
|
|
|
+ !this.selectionRight.find((t) => t.bomSubId == i.bomSubId)
|
|
|
);
|
|
|
-
|
|
|
this.datasourceShow.push(...this.selectionRight);
|
|
|
- this.datasource.push(...this.selectionRight);
|
|
|
-
|
|
|
this.selectionRight = [];
|
|
|
},
|
|
|
- reload () {
|
|
|
- this.datasourceShow = this.datasource.filter((item) => {
|
|
|
- return (
|
|
|
- (!this.where.categoryLevelGroupId ||
|
|
|
- item.categoryLevelGroupId.includes(
|
|
|
- this.where.categoryLevelGroupId
|
|
|
- )) &&
|
|
|
- (!this.where.code || item.code.includes(this.where.code)) &&
|
|
|
- (!this.where.name || item.name.includes(this.where.name)) &&
|
|
|
- (!this.where.modelType ||
|
|
|
- item.modelType.includes(this.where.modelType))
|
|
|
- );
|
|
|
- });
|
|
|
- },
|
|
|
- reloadRight () {
|
|
|
- this.datasourceRightShow = this.datasourceRight.filter((item) => {
|
|
|
- return (
|
|
|
- (!this.whereRight.categoryLevelGroupId ||
|
|
|
- item.categoryLevelGroupId.includes(
|
|
|
- this.whereRight.categoryLevelGroupId
|
|
|
- )) &&
|
|
|
- (!this.whereRight.code ||
|
|
|
- item.code.includes(this.whereRight.code)) &&
|
|
|
- (!this.whereRight.name ||
|
|
|
- item.name.includes(this.whereRight.name)) &&
|
|
|
- (!this.whereRight.modelType ||
|
|
|
- item.modelType.includes(this.whereRight.modelType))
|
|
|
- );
|
|
|
- });
|
|
|
- },
|
|
|
async getDatasource () {
|
|
|
- const data = await unassociated({
|
|
|
- categoryLevelGroupId: this.idMap[this.type]
|
|
|
- });
|
|
|
- this.datasource = data.slice(0);
|
|
|
- this.datasourceShow = data.slice(0);
|
|
|
+ const params = {
|
|
|
+ bomId:this.row.bomId,
|
|
|
+ produceVersionId:this.row.produceVersionId,
|
|
|
+ routingTaskId:this.row.id,
|
|
|
+ pageNum:1,
|
|
|
+ size:-1
|
|
|
+ }
|
|
|
+ const data = await getBomSubList(params);
|
|
|
+ if(typeof data.uncorrelatedList == 'string' ){
|
|
|
+ this.datasource = []
|
|
|
+ }else{
|
|
|
+ this.datasourceShow = data.uncorrelatedList;
|
|
|
+ }
|
|
|
+ if(typeof data.correlatedList == 'string' ){
|
|
|
+ this.datasourceRightShow = []
|
|
|
+ }else{
|
|
|
+ this.datasourceRightShow = data.correlatedList;
|
|
|
+ }
|
|
|
},
|
|
|
- async getDatasourceRight () {
|
|
|
- const data = await getRelatesInformationList({
|
|
|
- mainCategoryId: this.row.categoryLevelId,
|
|
|
- // categoryLevelGroupId: this.idMap[this.type],
|
|
|
- categoryLevelRootId: this.type
|
|
|
- });
|
|
|
- this.datasourceRight = data.slice(0);
|
|
|
- this.datasourceRightShow = data.slice(0);
|
|
|
- }
|
|
|
}
|
|
|
};
|
|
|
</script>
|