|
|
@@ -131,47 +131,72 @@
|
|
|
></el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
- <ele-pro-table
|
|
|
- ref="tableRight"
|
|
|
- :columns="columnsRight"
|
|
|
- :datasource="datasourceRightShow"
|
|
|
- :selection.sync="selectionRight"
|
|
|
- height="45vh"
|
|
|
- :initLoad="false"
|
|
|
- :need-page="false"
|
|
|
- cache-key="link-material-dialog-right"
|
|
|
+ <el-form
|
|
|
+ ref="formRef"
|
|
|
+ :model="{ datasourceRightShow }"
|
|
|
+ label-width="0"
|
|
|
+ :show-message="false"
|
|
|
>
|
|
|
- <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>
|
|
|
- <template v-slot:angle="{ row }">
|
|
|
- <DictSelection dictName="角度" clearable v-model="row.angle">
|
|
|
- </DictSelection>
|
|
|
- </template>
|
|
|
+ <ele-pro-table
|
|
|
+ ref="tableRight"
|
|
|
+ :columns="columnsRight"
|
|
|
+ :datasource="datasourceRightShow"
|
|
|
+ :selection.sync="selectionRight"
|
|
|
+ height="45vh"
|
|
|
+ :initLoad="false"
|
|
|
+ :need-page="false"
|
|
|
+ cache-key="link-material-dialog-right"
|
|
|
+ >
|
|
|
+ <template v-slot:capacity="{ row, $index }">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item
|
|
|
+ :rules="rules.quantity"
|
|
|
+ :prop="`datasourceRightShow.${$index}.quantity`"
|
|
|
+ >
|
|
|
+ <el-input v-model="row.quantity"></el-input> </el-form-item
|
|
|
+ ></el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item
|
|
|
+ :rules="rules.quantityUnitId"
|
|
|
+ :prop="`datasourceRightShow.${$index}.quantityUnitId`"
|
|
|
+ >
|
|
|
+ <DictSelection
|
|
|
+ class="line-select"
|
|
|
+ dictName="重量单位"
|
|
|
+ clearable
|
|
|
+ v-model="row.quantityUnitId"
|
|
|
+ >
|
|
|
+ </DictSelection>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item
|
|
|
+ :rules="rules.timeUnit"
|
|
|
+ :prop="`datasourceRightShow.${$index}.timeUnit`"
|
|
|
+ >
|
|
|
+ <DictSelection
|
|
|
+ class="line-select"
|
|
|
+ dictName="提前期单位"
|
|
|
+ clearable
|
|
|
+ v-model="row.timeUnit"
|
|
|
+ >
|
|
|
+ </DictSelection> </el-form-item
|
|
|
+ ></el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ <template v-slot:angle="{ row, $index }">
|
|
|
+ <el-form-item
|
|
|
+ :rules="rules.angle"
|
|
|
+ :prop="`datasourceRightShow.${$index}.angle`"
|
|
|
+ >
|
|
|
+ <DictSelection dictName="角度" clearable v-model="row.angle">
|
|
|
+ </DictSelection>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
</ele-pro-table>
|
|
|
- </el-col>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
</el-row>
|
|
|
|
|
|
<div slot="footer" class="footer">
|
|
|
@@ -209,6 +234,12 @@
|
|
|
8: '1678278350275198977',
|
|
|
4: '1678277959244431361',
|
|
|
5: '1678277781556936705'
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ quantity: [{ required: true }],
|
|
|
+ quantityUnitId: [{ required: true }],
|
|
|
+ timeUnit: [{ required: true }],
|
|
|
+ angle: [{ required: true }]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
@@ -274,7 +305,7 @@
|
|
|
{
|
|
|
label: '槽数',
|
|
|
prop: 'slotNum',
|
|
|
- formatter:(_row, _column, cellValue) => {
|
|
|
+ formatter: (_row, _column, cellValue) => {
|
|
|
return _row.extendInfo.slotNum;
|
|
|
}
|
|
|
},
|
|
|
@@ -312,23 +343,29 @@
|
|
|
this.whereRight = {};
|
|
|
this.where = {};
|
|
|
},
|
|
|
- async save () {
|
|
|
+ save () {
|
|
|
// if (!this.datasourceRightShow.length) {
|
|
|
// return this.$message.error('请添加关联数据');
|
|
|
// }
|
|
|
- const params = {
|
|
|
- mainCategoryId: this.row.id,
|
|
|
- mainCategoryLevelRootId: this.type,
|
|
|
- materialDetailsPOList: this.datasourceRightShow.map((i) => ({
|
|
|
- ...i,
|
|
|
- categoryLevelRootId: this.type
|
|
|
- }))
|
|
|
- };
|
|
|
- await productTieUpMaterial(params);
|
|
|
- this.cancel();
|
|
|
+ this.$refs.formRef.validate(async (value) => {
|
|
|
+ if (value) {
|
|
|
+ const params = {
|
|
|
+ mainCategoryId: this.row.id,
|
|
|
+ mainCategoryLevelRootId: this.type,
|
|
|
+ materialDetailsPOList: this.datasourceRightShow.map((i) => ({
|
|
|
+ ...i,
|
|
|
+ categoryLevelRootId: this.type
|
|
|
+ }))
|
|
|
+ };
|
|
|
+ await productTieUpMaterial(params);
|
|
|
+ this.cancel();
|
|
|
|
|
|
- this.$message.success('操作成功!');
|
|
|
- this.$emit('success');
|
|
|
+ this.$message.success('操作成功!');
|
|
|
+ this.$emit('success');
|
|
|
+ } else {
|
|
|
+ this.$message.error('请完善信息!');
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
handleConect () {
|
|
|
if (!this.selection.length) {
|
|
|
@@ -367,9 +404,7 @@
|
|
|
this.datasourceShow = this.datasource.filter((item) => {
|
|
|
return (
|
|
|
(!this.where.categoryId ||
|
|
|
- item.parentId.includes(
|
|
|
- this.where.categoryId
|
|
|
- )) &&
|
|
|
+ item.parentId.includes(this.where.categoryId)) &&
|
|
|
(!this.where.code || item.code.includes(this.where.code)) &&
|
|
|
(!this.where.name || item.name.includes(this.where.name)) &&
|
|
|
(!this.where.modelType ||
|
|
|
@@ -381,9 +416,7 @@
|
|
|
this.datasourceRightShow = this.datasourceRight.filter((item) => {
|
|
|
return (
|
|
|
(!this.whereRight.categoryId ||
|
|
|
- item.parentId.includes(
|
|
|
- this.whereRight.categoryId
|
|
|
- )) &&
|
|
|
+ item.parentId.includes(this.whereRight.categoryId)) &&
|
|
|
(!this.whereRight.code ||
|
|
|
item.code.includes(this.whereRight.code)) &&
|
|
|
(!this.whereRight.name ||
|