|
|
@@ -24,23 +24,32 @@
|
|
|
<el-form label-width="100px">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item :label="`${catogaryName}分类`">
|
|
|
- <el-input
|
|
|
+ <el-form-item :label="`分类`">
|
|
|
+ <categorySelect
|
|
|
+ :pid="type"
|
|
|
+ :key="type"
|
|
|
+ v-model="where.categoryLevelGroupId"
|
|
|
+ />
|
|
|
+ <!-- <el-input
|
|
|
placeholder="请输入"
|
|
|
- v-model="where.categoryLevelRootId"
|
|
|
- ></el-input> </el-form-item
|
|
|
- ></el-col>
|
|
|
+ clearable
|
|
|
+ v-model="where.categoryLevelGroupId"
|
|
|
+ ></el-input> -->
|
|
|
+ </el-form-item></el-col
|
|
|
+ >
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item :label="`${catogaryName}编码`">
|
|
|
+ <el-form-item :label="`编码`">
|
|
|
<el-input
|
|
|
placeholder="请输入"
|
|
|
+ clearable
|
|
|
v-model="where.code"
|
|
|
></el-input></el-form-item
|
|
|
></el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item :label="`${catogaryName}名称`">
|
|
|
+ <el-form-item :label="`名称`">
|
|
|
<el-input
|
|
|
placeholder="请输入"
|
|
|
+ clearable
|
|
|
v-model="where.name"
|
|
|
></el-input></el-form-item
|
|
|
></el-col>
|
|
|
@@ -48,6 +57,7 @@
|
|
|
<el-form-item label="型号">
|
|
|
<el-input
|
|
|
placeholder="请输入"
|
|
|
+ clearable
|
|
|
v-model="where.modelType"
|
|
|
></el-input></el-form-item
|
|
|
></el-col>
|
|
|
@@ -56,7 +66,7 @@
|
|
|
<ele-pro-table
|
|
|
ref="table"
|
|
|
:columns="columns"
|
|
|
- :datasource="datasource"
|
|
|
+ :datasource="datasourceShow"
|
|
|
:selection.sync="selection"
|
|
|
cache-key="link-material-dialog"
|
|
|
height="45vh"
|
|
|
@@ -88,22 +98,25 @@
|
|
|
<el-form label-width="100px">
|
|
|
<el-row>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item :label="`${catogaryName}分类`">
|
|
|
- <el-input
|
|
|
- placeholder="请输入"
|
|
|
- v-model="whereRight.categoryLevelRootId"
|
|
|
- ></el-input> </el-form-item
|
|
|
+ <el-form-item :label="`分类`">
|
|
|
+ <categorySelect
|
|
|
+ :pid="type"
|
|
|
+ :key="type"
|
|
|
+ v-model="whereRight.categoryLevelGroupId"
|
|
|
+ /> </el-form-item
|
|
|
></el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item :label="`${catogaryName}编码`">
|
|
|
+ <el-form-item :label="`编码`">
|
|
|
<el-input
|
|
|
+ clearable
|
|
|
placeholder="请输入"
|
|
|
v-model="whereRight.code"
|
|
|
></el-input></el-form-item
|
|
|
></el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item :label="`${catogaryName}名称`">
|
|
|
+ <el-form-item :label="`名称`">
|
|
|
<el-input
|
|
|
+ clearable
|
|
|
placeholder="请输入"
|
|
|
v-model="whereRight.name"
|
|
|
></el-input></el-form-item
|
|
|
@@ -111,6 +124,7 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="型号">
|
|
|
<el-input
|
|
|
+ clearable
|
|
|
placeholder="请输入"
|
|
|
v-model="whereRight.modelType"
|
|
|
></el-input></el-form-item
|
|
|
@@ -120,7 +134,7 @@
|
|
|
<ele-pro-table
|
|
|
ref="tableRight"
|
|
|
:columns="columnsRight"
|
|
|
- :datasource="datasourceRight"
|
|
|
+ :datasource="datasourceRightShow"
|
|
|
:selection.sync="selectionRight"
|
|
|
height="45vh"
|
|
|
:initLoad="false"
|
|
|
@@ -151,6 +165,10 @@
|
|
|
</DictSelection
|
|
|
></el-col>
|
|
|
</el-row>
|
|
|
+ </template>
|
|
|
+ <template v-slot:angle="{ row }">
|
|
|
+ <DictSelection dictName="角度" clearable v-model="row.angle">
|
|
|
+ </DictSelection>
|
|
|
</template> </ele-pro-table
|
|
|
></el-col>
|
|
|
</el-row>
|
|
|
@@ -169,13 +187,17 @@
|
|
|
productTieUpMaterial
|
|
|
} from '@/api/material/product.js';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
+ import categorySelect from '@/components/CommomSelect/category-select.vue';
|
|
|
export default {
|
|
|
mixins: [dictMixins],
|
|
|
+ components: { categorySelect },
|
|
|
data () {
|
|
|
return {
|
|
|
visible: false,
|
|
|
row: {},
|
|
|
datasource: [],
|
|
|
+ datasourceShow: [],
|
|
|
+ datasourceRightShow: [],
|
|
|
datasourceRight: [],
|
|
|
selectionRight: [],
|
|
|
selection: [],
|
|
|
@@ -243,11 +265,28 @@
|
|
|
label: '型号',
|
|
|
prop: 'modelType'
|
|
|
},
|
|
|
- {
|
|
|
- label: '产能',
|
|
|
- slot: 'capacity',
|
|
|
- action: 'capacity'
|
|
|
- }
|
|
|
+ ...(this.type == 8
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ label: '槽数',
|
|
|
+ prop: 'modelType'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '角度',
|
|
|
+ slot: 'angle',
|
|
|
+ action: 'angle'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ : []),
|
|
|
+ ...(this.type == 4
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ label: '产能',
|
|
|
+ slot: 'capacity',
|
|
|
+ action: 'capacity'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ : [])
|
|
|
];
|
|
|
}
|
|
|
},
|
|
|
@@ -263,18 +302,18 @@
|
|
|
this.visible = false;
|
|
|
},
|
|
|
async save () {
|
|
|
- if (!this.datasourceRight.length) {
|
|
|
+ if (!this.datasourceRightShow.length) {
|
|
|
return this.$message.error('请添加关联数据');
|
|
|
}
|
|
|
const params = {
|
|
|
mainCategoryId: this.row.categoryLevelId,
|
|
|
mainCategoryLevelRootId: this.row.categoryLevelGroupId,
|
|
|
- materialDetailsPOList: this.datasourceRight.map((i) => ({
|
|
|
+ materialDetailsPOList: this.datasourceRightShow.map((i) => ({
|
|
|
...i,
|
|
|
categoryLevelRootId: this.type
|
|
|
}))
|
|
|
};
|
|
|
- const res = await productTieUpMaterial(params);
|
|
|
+ await productTieUpMaterial(params);
|
|
|
|
|
|
this.$message.success('操作成功!');
|
|
|
this.$emit('success');
|
|
|
@@ -283,44 +322,80 @@
|
|
|
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.datasourceRightShow.push(...this.selection);
|
|
|
this.datasourceRight.push(...this.selection);
|
|
|
- this.selection = [];
|
|
|
|
|
|
- // this. "quantity": "",
|
|
|
- // "quantityUnitId": "",
|
|
|
- // "timeUnit": 0,
|
|
|
- // "timeValue": 0
|
|
|
+ this.selection = [];
|
|
|
},
|
|
|
handleCancelConect () {
|
|
|
if (!this.selectionRight.length) {
|
|
|
return this.$message.error('请选择取消关联数据');
|
|
|
}
|
|
|
|
|
|
- this.datasourceRight.push(...this.selectionRight);
|
|
|
+ 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.datasourceShow.push(...this.selectionRight);
|
|
|
+ this.datasource.push(...this.selectionRight);
|
|
|
+
|
|
|
this.selectionRight = [];
|
|
|
},
|
|
|
reload () {
|
|
|
- this.$refs.table.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.$refs.tableRight.reload();
|
|
|
+ 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;
|
|
|
+ this.datasource = data.slice(0);
|
|
|
+ this.datasourceShow = data.slice(0);
|
|
|
},
|
|
|
async getDatasourceRight () {
|
|
|
const data = await getRelatesInformationList({
|
|
|
mainCategoryId: this.row.categoryLevelId,
|
|
|
- categoryLevelGroupId: this.idMap[this.type]
|
|
|
+ // categoryLevelGroupId: this.idMap[this.type],
|
|
|
+ categoryLevelRootId: this.type
|
|
|
});
|
|
|
- this.datasourceRight = data;
|
|
|
- },
|
|
|
- async _productTieUpMaterial () {
|
|
|
- const data = await productTieUpMaterial();
|
|
|
- console.log(data);
|
|
|
+ this.datasourceRight = data.slice(0);
|
|
|
+ this.datasourceRightShow = data.slice(0);
|
|
|
}
|
|
|
}
|
|
|
};
|