|
|
|
@ -70,7 +70,8 @@
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="handleAdd"
|
|
|
|
|
v-hasPermi="['mes:materialBom:add']"
|
|
|
|
|
>新增</el-button>
|
|
|
|
|
>新增
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button
|
|
|
|
@ -79,7 +80,8 @@
|
|
|
|
|
icon="el-icon-sort"
|
|
|
|
|
size="mini"
|
|
|
|
|
@click="toggleExpandAll"
|
|
|
|
|
>展开/折叠</el-button>
|
|
|
|
|
>展开/折叠
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
|
|
|
|
|
</el-row>
|
|
|
|
@ -123,21 +125,24 @@
|
|
|
|
|
icon="el-icon-edit"
|
|
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
|
|
v-hasPermi="['mes:materialBom:edit']"
|
|
|
|
|
>修改</el-button>
|
|
|
|
|
>修改
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-plus"
|
|
|
|
|
@click="handleAdd(scope.row)"
|
|
|
|
|
v-hasPermi="['mes:materialBom:add']"
|
|
|
|
|
>新增子BOM</el-button>
|
|
|
|
|
>新增子BOM
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button
|
|
|
|
|
size="mini"
|
|
|
|
|
type="text"
|
|
|
|
|
icon="el-icon-delete"
|
|
|
|
|
@click="handleDelete(scope.row)"
|
|
|
|
|
v-hasPermi="['mes:materialBom:remove']"
|
|
|
|
|
>删除</el-button>
|
|
|
|
|
>删除
|
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
@ -177,7 +182,8 @@
|
|
|
|
|
v-for="dict in dict.type.check_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
>{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="项目ID" prop="projectId">
|
|
|
|
@ -189,7 +195,8 @@
|
|
|
|
|
v-for="dict in dict.type.active_flag"
|
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.value"
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
>{{ dict.label }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
|
@ -215,10 +222,17 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import { listMaterialBom, getMaterialBom, delMaterialBom, addMaterialBom, updateMaterialBom } from "@/api/mes/materialBom";
|
|
|
|
|
import {
|
|
|
|
|
listMaterialBom,
|
|
|
|
|
getMaterialBom,
|
|
|
|
|
delMaterialBom,
|
|
|
|
|
addMaterialBom,
|
|
|
|
|
updateMaterialBom
|
|
|
|
|
} from "@/api/mes/materialBom";
|
|
|
|
|
import Treeselect from "@riophae/vue-treeselect";
|
|
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
import addBom from '@//views/mes/materialBom/addBom.vue';
|
|
|
|
|
import {verifyBOMIsProduction} from "@//api/mes/productOrder";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "MaterialBom",
|
|
|
|
@ -371,13 +385,22 @@ export default {
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
if (row != null && row.materialBomId) {
|
|
|
|
|
this.form.parentId = row.materialBomId;
|
|
|
|
|
} else {
|
|
|
|
|
this.form.parentId = 0;
|
|
|
|
|
verifyBOMIsProduction(row.materialBomId).then(res => {
|
|
|
|
|
if (res.data) {
|
|
|
|
|
throw Error()
|
|
|
|
|
}
|
|
|
|
|
//BOM说明,顶级不能为空,在选择bom时可以用此字段区分
|
|
|
|
|
this.rules.materialBomDesc[0].required = this.form.parentId === 0;
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "添加物料BOM信息";
|
|
|
|
|
|
|
|
|
|
}).catch((e) => {
|
|
|
|
|
this.$modal.msgError("该物料BOM已被生产工单选择,无法新增!");
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.form.parentId = 0;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
handleMaterialAdd() {
|
|
|
|
@ -397,7 +420,10 @@ export default {
|
|
|
|
|
this.getTreeselect();
|
|
|
|
|
if (row != null) {
|
|
|
|
|
this.form.parentId = row.materialBomId;
|
|
|
|
|
}
|
|
|
|
|
verifyBOMIsProduction(row.materialBomId).then(res => {
|
|
|
|
|
if (res.data) {
|
|
|
|
|
this.$modal.msgError("该物料BOM已被生产工单选择,无法修改!");
|
|
|
|
|
} else {
|
|
|
|
|
getMaterialBom(row.materialBomId).then(response => {
|
|
|
|
|
this.form = response.data;
|
|
|
|
|
//BOM说明,顶级不能为空,在选择bom时可以用此字段区分
|
|
|
|
@ -405,6 +431,9 @@ export default {
|
|
|
|
|
this.open = true;
|
|
|
|
|
this.title = "修改物料BOM信息";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
|
submitForm() {
|
|
|
|
@ -440,12 +469,21 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
/** 删除按钮操作 */
|
|
|
|
|
handleDelete(row) {
|
|
|
|
|
this.$modal.confirm('是否确认删除物料BOM信息编号为"' + row.materialBomId + '"的数据项?').then(function() {
|
|
|
|
|
verifyBOMIsProduction(row.materialBomId).then(res => {
|
|
|
|
|
if (res.data) {
|
|
|
|
|
throw Error()
|
|
|
|
|
}
|
|
|
|
|
this.$modal.confirm('是否确认删除物料名称为"' + row.materialName + '"的数据项?').then(function () {
|
|
|
|
|
return delMaterialBom(row.materialBomId);
|
|
|
|
|
}).then(() => {
|
|
|
|
|
this.getList();
|
|
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
|
|
}).catch(() => {});
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
});
|
|
|
|
|
}).catch((e) => {
|
|
|
|
|
this.$modal.msgError("该物料BOM已被生产工单选择,无法删除!");
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|