|
|
@@ -5,7 +5,13 @@
|
|
|
<headerTitle>
|
|
|
<template v-slot:title>
|
|
|
可选
|
|
|
- <el-button type="primary" class="ml20" size="mini">关联</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ class="ml20"
|
|
|
+ size="mini"
|
|
|
+ @click="handleConect"
|
|
|
+ >关联</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
size="mini"
|
|
|
@@ -51,6 +57,7 @@
|
|
|
ref="table"
|
|
|
:columns="columns"
|
|
|
:datasource="datasource"
|
|
|
+ :selection.sync="selection"
|
|
|
cache-key="link-material-dialog"
|
|
|
height="45vh"
|
|
|
:initLoad="false"
|
|
|
@@ -62,7 +69,11 @@
|
|
|
<headerTitle
|
|
|
><template v-slot:title
|
|
|
>已关联
|
|
|
- <el-button type="primary" class="ml20" size="mini"
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ class="ml20"
|
|
|
+ size="mini"
|
|
|
+ @click="handleCancelConect"
|
|
|
>取消关联</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
@@ -110,12 +121,37 @@
|
|
|
ref="tableRight"
|
|
|
:columns="columnsRight"
|
|
|
:datasource="datasourceRight"
|
|
|
+ :selection.sync="selectionRight"
|
|
|
height="45vh"
|
|
|
:initLoad="false"
|
|
|
:need-page="false"
|
|
|
cache-key="link-material-dialog-right"
|
|
|
>
|
|
|
- </ele-pro-table
|
|
|
+ <template v-slot:capacity="{ row }">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-input v-model="row.quantity"></el-input
|
|
|
+ ></el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <DictSelection
|
|
|
+ class="line-select"
|
|
|
+ dictName="重量单位"
|
|
|
+ clearable
|
|
|
+ v-model="row.quantityUnitId"
|
|
|
+ >
|
|
|
+ </DictSelection
|
|
|
+ ></el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <DictSelection
|
|
|
+ class="line-select"
|
|
|
+ dictName="提前期单位"
|
|
|
+ clearable
|
|
|
+ v-model="row.timeUnit"
|
|
|
+ >
|
|
|
+ </DictSelection
|
|
|
+ ></el-col>
|
|
|
+ </el-row>
|
|
|
+ </template> </ele-pro-table
|
|
|
></el-col>
|
|
|
</el-row>
|
|
|
|
|
|
@@ -139,9 +175,18 @@
|
|
|
return {
|
|
|
visible: false,
|
|
|
row: {},
|
|
|
+ datasource: [],
|
|
|
+ datasourceRight: [],
|
|
|
+ selectionRight: [],
|
|
|
+ selection: [],
|
|
|
whereRight: {},
|
|
|
where: {},
|
|
|
- type: ''
|
|
|
+ type: '',
|
|
|
+ idMap: {
|
|
|
+ 8: '1678278350275198977',
|
|
|
+ 4: '1678277959244431361',
|
|
|
+ 5: '1678277781556936705'
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
created () {
|
|
|
@@ -151,6 +196,7 @@
|
|
|
catogaryName () {
|
|
|
return this.getDictValue('类型用途', this.type);
|
|
|
},
|
|
|
+ dict () {},
|
|
|
columns () {
|
|
|
return [
|
|
|
{
|
|
|
@@ -158,16 +204,20 @@
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- label: `${this.catogaryName}分类`
|
|
|
+ label: `${this.catogaryName}分类`,
|
|
|
+ prop: 'categoryLevelGroupName'
|
|
|
},
|
|
|
{
|
|
|
- label: `${this.catogaryName}编码`
|
|
|
+ label: `${this.catogaryName}编码`,
|
|
|
+ prop: 'code'
|
|
|
},
|
|
|
{
|
|
|
- label: `${this.catogaryName}名称`
|
|
|
+ label: `${this.catogaryName}名称`,
|
|
|
+ prop: 'name'
|
|
|
},
|
|
|
{
|
|
|
- label: '型号'
|
|
|
+ label: '型号',
|
|
|
+ prop: 'modelType'
|
|
|
}
|
|
|
];
|
|
|
},
|
|
|
@@ -178,19 +228,25 @@
|
|
|
align: 'center'
|
|
|
},
|
|
|
{
|
|
|
- label: `${this.catogaryName}分类`
|
|
|
+ label: `${this.catogaryName}分类`,
|
|
|
+ prop: 'categoryLevelGroupName'
|
|
|
},
|
|
|
{
|
|
|
- label: `${this.catogaryName}编码`
|
|
|
+ label: `${this.catogaryName}编码`,
|
|
|
+ prop: 'code'
|
|
|
},
|
|
|
{
|
|
|
- label: `${this.catogaryName}名称`
|
|
|
+ label: `${this.catogaryName}名称`,
|
|
|
+ prop: 'name'
|
|
|
},
|
|
|
{
|
|
|
- label: '型号'
|
|
|
+ label: '型号',
|
|
|
+ prop: 'modelType'
|
|
|
},
|
|
|
{
|
|
|
- label: '产能'
|
|
|
+ label: '产能',
|
|
|
+ slot: 'capacity',
|
|
|
+ action: 'capacity'
|
|
|
}
|
|
|
];
|
|
|
}
|
|
|
@@ -199,33 +255,68 @@
|
|
|
open (type, row) {
|
|
|
this.type = type;
|
|
|
this.row = row;
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.table.reload();
|
|
|
- this.$refs.tableRight.reload();
|
|
|
- });
|
|
|
+ this.getDatasource();
|
|
|
+ this.getDatasourceRight();
|
|
|
this.visible = true;
|
|
|
},
|
|
|
cancel () {
|
|
|
this.visible = false;
|
|
|
},
|
|
|
- save () {},
|
|
|
+ async save () {
|
|
|
+ if (!this.datasourceRight.length) {
|
|
|
+ return this.$message.error('请添加关联数据');
|
|
|
+ }
|
|
|
+ const params = {
|
|
|
+ mainCategoryId: this.row.categoryLevelId,
|
|
|
+ mainCategoryLevelRootId: this.row.categoryLevelGroupId,
|
|
|
+ materialDetailsPOList: this.datasourceRight.map((i) => ({
|
|
|
+ ...i,
|
|
|
+ categoryLevelRootId: this.type
|
|
|
+ }))
|
|
|
+ };
|
|
|
+ const res = await productTieUpMaterial(params);
|
|
|
+
|
|
|
+ this.$message.success('操作成功!');
|
|
|
+ this.$emit('success');
|
|
|
+ },
|
|
|
+ handleConect () {
|
|
|
+ if (!this.selection.length) {
|
|
|
+ return this.$message.error('请选择关联数据');
|
|
|
+ }
|
|
|
+ this.datasourceRight.push(...this.selection);
|
|
|
+ this.selection = [];
|
|
|
+
|
|
|
+ // this. "quantity": "",
|
|
|
+ // "quantityUnitId": "",
|
|
|
+ // "timeUnit": 0,
|
|
|
+ // "timeValue": 0
|
|
|
+ },
|
|
|
+ handleCancelConect () {
|
|
|
+ if (!this.selectionRight.length) {
|
|
|
+ return this.$message.error('请选择取消关联数据');
|
|
|
+ }
|
|
|
+
|
|
|
+ this.datasourceRight.push(...this.selectionRight);
|
|
|
+ this.selectionRight = [];
|
|
|
+ },
|
|
|
reload () {
|
|
|
this.$refs.table.reload();
|
|
|
},
|
|
|
reloadRight () {
|
|
|
this.$refs.tableRight.reload();
|
|
|
},
|
|
|
- datasource ({ where }) {
|
|
|
- return getRelatesInformationList({
|
|
|
- ...where,
|
|
|
- mainCategoryId: this.row.categoryLevelId
|
|
|
+ async getDatasource () {
|
|
|
+ const data = await unassociated({
|
|
|
+ categoryLevelGroupId: this.idMap[this.type]
|
|
|
});
|
|
|
+ this.datasource = data;
|
|
|
},
|
|
|
- datasourceRight ({ where }) {
|
|
|
- return unassociated({
|
|
|
- ...where,
|
|
|
- mainCategoryId: this.row.categoryLevelId
|
|
|
+ async getDatasourceRight () {
|
|
|
+ const data = await getRelatesInformationList({
|
|
|
+ mainCategoryId: this.row.categoryLevelId,
|
|
|
+ categoryLevelGroupId: this.idMap[this.type]
|
|
|
});
|
|
|
+ this.datasourceRight = data;
|
|
|
},
|
|
|
async _productTieUpMaterial () {
|
|
|
const data = await productTieUpMaterial();
|