|
@@ -25,6 +25,29 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
+ <template #work="{ item }">
|
|
|
+ <div style="width:100%">
|
|
|
+ <span style="padding: 4px" :class="[item.researchBomStatus == 1 ? 'active' : 'disActive']">
|
|
|
+ 【研】设计
|
|
|
+ </span>
|
|
|
+ <span style="padding: 4px;margin-left:8px" :class="[item.researchBomStatus == 1 ? 'active' : 'disActive']">
|
|
|
+ 【研】BOM
|
|
|
+ </span>
|
|
|
+ <span style="padding: 4px;margin-left:8px" :class="[item.electricianBomStatus == 1 ? 'active' : 'disActive']">
|
|
|
+ 【电】BOM
|
|
|
+ </span>
|
|
|
+ <span style="padding: 4px" :class="[item.technologyStatus == 1 ? 'active' : 'disActive']">
|
|
|
+ 【制】工序
|
|
|
+ </span>
|
|
|
+ <span style="padding: 4px;margin-left:8px" :class="[item.bomStatus == 1 ? 'active' : 'disActive']">
|
|
|
+ 【制】BOM
|
|
|
+ </span>
|
|
|
+ <span style="padding: 4px;margin-left:8px" :class="[item.productionQuantity ? 'active' : 'disActive']">
|
|
|
+ 【制】下发
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
<template #completionRate="{ item }">
|
|
|
<div style="width: 100%">
|
|
|
<el-progress type="circle" :percentage="Number(item.completionRate)" width="60"
|
|
@@ -41,60 +64,71 @@
|
|
|
|
|
|
<!-- 研发 -->
|
|
|
<span v-if="isYanFa">
|
|
|
- <el-button text type="primary" @click="handleUploadFile(item, false)">{{
|
|
|
+ <el-button text type="primary" @click="handleUploadFile(item, false)" v-if="item.devUserId==userId">
|
|
|
+ <!-- {{
|
|
|
item.researchStatus ? "查看" : "上传"
|
|
|
- }}设计资料</el-button>
|
|
|
-
|
|
|
- <el-button text type="primary" @click="getDtl(item, item.bomStatus ? true : false)">{{ item.bomStatus ? "查看" : "调整" }}BOM</el-button>
|
|
|
-
|
|
|
+ }} -->
|
|
|
+ 设计资料
|
|
|
+ </el-button>
|
|
|
+ <el-button text type="primary" v-if="item.devUserId==userId" @click="getDtl(item, item.researchBomStatus ? true : false,'all')">
|
|
|
+ <!-- {{ item.researchBomStatus ? "查看" : "调整" }} -->
|
|
|
+ BOM</el-button>
|
|
|
+ </span>
|
|
|
+ <!-- 电控 -->
|
|
|
+ <span v-if="isDianGong">
|
|
|
+ <el-button text type="primary" v-if="item.researchStatus && item.researchBomStatus"
|
|
|
+ @click="getDtl(item, item.electricianBomStatus ? true : false,2)">
|
|
|
+ <!-- {{ item.electricianBomStatus ? "查看" : "调整" }} -->
|
|
|
+ BOM</el-button>
|
|
|
</span>
|
|
|
|
|
|
<!-- 制图 -->
|
|
|
- <div v-if="isZhiTu && item.researchStatus">
|
|
|
+ <span v-if="isZhiTu && item.researchStatus">
|
|
|
<span v-if="item.isCustomized == 1">
|
|
|
- <el-button text type="primary"
|
|
|
- @click="getDtl(item, item.bomStatus ? true : false)">{{ item.bomStatus ? "查看" : "调整" }}BOM</el-button>
|
|
|
+ <el-button text type="primary" @click="getDtl(item, item.bomStatus ? true : false,1)">
|
|
|
+ <!-- {{ item.bomStatus ? "查看" : "调整" }} -->
|
|
|
+ BOM</el-button>
|
|
|
</span>
|
|
|
<span v-if="item.isCustomized == 1">
|
|
|
<el-button text type="primary" @click="
|
|
|
getDtlOne(item, item.technologyStatus ? true : false)
|
|
|
- ">{{
|
|
|
+ ">
|
|
|
+ <!-- {{
|
|
|
item.technologyStatus ? "查看" : "调整"
|
|
|
- }}工艺</el-button>
|
|
|
- </span>
|
|
|
- <span v-if="item.productionQuantity == null">
|
|
|
- <el-button text type="primary" @click="handleOut(item)">下发</el-button>
|
|
|
- </span>
|
|
|
- <span>
|
|
|
- <el-button text type="primary" @click="handlePrint(item)">打印</el-button>
|
|
|
+ }} -->
|
|
|
+ 工艺</el-button>
|
|
|
</span>
|
|
|
<span>
|
|
|
- <el-button text type="primary" @click="handleUploadFile(item, true)">查看设计资料</el-button>
|
|
|
+ <el-button text type="primary" @click="handleUploadFile(item, true)">设计资料</el-button>
|
|
|
</span>
|
|
|
- </div>
|
|
|
- <div v-if="isDianGong && item.researchStatus">
|
|
|
- <span v-if="item.isCustomized == 1">
|
|
|
- <el-button text type="primary"
|
|
|
- @click="getDtl(item, item.bomStatus ? true : false)">{{ item.bomStatus ? "查看" : "调整" }}BOM</el-button>
|
|
|
+ </span>
|
|
|
+ <span v-if="item.isCustomized == 0">
|
|
|
+ <span v-if="item.productionQuantity == null">
|
|
|
+ <el-button text type="primary" @click="handleOut(item)">下发</el-button>
|
|
|
</span>
|
|
|
- </div>
|
|
|
+ </span>
|
|
|
+
|
|
|
+ <span>
|
|
|
+ <el-button text type="primary" @click="handlePrint(item)">打印</el-button>
|
|
|
+ </span>
|
|
|
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</byTable>
|
|
|
</div>
|
|
|
- <el-dialog :title="!isDetail ? '调整BOM' : '查看BOM'" v-model="dialogVisible" width="60%" v-loading="submitLoading" destroy-on-close>
|
|
|
+ <!-- 研发调整bom -->
|
|
|
+
|
|
|
+ <el-dialog :title="!isDetail ? '调整BOM' : '查看BOM'" v-model="dialogVisible" width="90%" v-loading="submitLoading" destroy-on-close>
|
|
|
<byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
|
|
|
<template #slot>
|
|
|
- <div style="width: 100%">
|
|
|
- <div style="color: red; font-size: 14px">
|
|
|
- 注意:这是单个产品的物料
|
|
|
- </div>
|
|
|
- <el-button type="primary" plain @click="openMaterial = true">添加物料/半成品</el-button>
|
|
|
- <!-- <el-button type="primary" plain> Excel导入</el-button> -->
|
|
|
- <el-form ref="tableForm" :model="formData.data" :rules="rules" label-width="0px" style="margin-top: 15px" :disabled="formOption.disabled">
|
|
|
- <el-table :data="formData.data.workOrderBomList">
|
|
|
+ <div style="width: 100%;display:flex">
|
|
|
+ <div style="width:50%;padding-right:10px" v-if="submitType==1 || submitType=='all'">
|
|
|
+ <div style="color: red; font-size: 14px">
|
|
|
+ 注意:这是单个产品的物料
|
|
|
+ </div>
|
|
|
+ <el-button type="primary" plain @click="clickSelect(1)">添加物料/半成品(五金)</el-button>
|
|
|
+ <el-table :data="formData.data.workOrderBomList" style="margin-top:15px">
|
|
|
<el-table-column prop="productCode" label="物料编码" />
|
|
|
<el-table-column prop="productName" label="物料名称" />
|
|
|
<el-table-column prop="productSpec" label="规格型号" />
|
|
@@ -110,11 +144,37 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="zip" label="操作" width="100">
|
|
|
<template #default="{ $index }">
|
|
|
- <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
|
|
|
+ <el-button type="primary" link @click="handleRemove($index,1)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+ <div style="width:50%;padding-left:10px" v-if="submitType==2 || submitType=='all'">
|
|
|
+ <div style="color: red; font-size: 14px">
|
|
|
+ 注意:这是单个产品的物料
|
|
|
+ </div>
|
|
|
+ <el-button type="primary" plain @click="clickSelect(2)">添加物料/半成品(电控)</el-button>
|
|
|
+ <el-table :data="formData.data.workOrderBomListOne" style="margin-top:15px">
|
|
|
+ <el-table-column prop="productCode" label="物料编码" />
|
|
|
+ <el-table-column prop="productName" label="物料名称" />
|
|
|
+ <el-table-column prop="productSpec" label="规格型号" />
|
|
|
+ <el-table-column prop="productUnit" label="单位" :formatter="
|
|
|
+ (row) => dictValueLabel(row.productUnit, materialUnit)
|
|
|
+ " />
|
|
|
+ <el-table-column prop="quantity" label="数量" width="150">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-form-item :prop="'workOrderBomListOne.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true">
|
|
|
+ <el-input-number v-model="row.quantity" :precision="2" :controls="false" :min="1" />
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="zip" label="操作" width="100">
|
|
|
+ <template #default="{ $index }">
|
|
|
+ <el-button type="primary" link @click="handleRemove($index,2)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- </el-form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</byForm>
|
|
@@ -254,7 +314,7 @@
|
|
|
</template>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <el-dialog v-model="openMaterial" title="选择产品" width="70%" append-to-body>
|
|
|
+ <el-dialog v-model="openMaterial" title="选择物料/半成品" width="70%" append-to-body>
|
|
|
<SelectMaterial @handleSelect="handleSelect"></SelectMaterial>
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
@@ -277,6 +337,7 @@ import Sortable from "sortablejs";
|
|
|
import ProductDemandPDF from "@/components/PDF/productDemandPDF.vue";
|
|
|
|
|
|
const userInfo = useUserStore();
|
|
|
+const userId = computed(() => userInfo.user.userId);
|
|
|
const props = defineProps({
|
|
|
isShowSelect: {
|
|
|
type: Boolean,
|
|
@@ -446,6 +507,14 @@ const config = computed(() => {
|
|
|
},
|
|
|
{
|
|
|
attrs: {
|
|
|
+ type: "slot",
|
|
|
+ label: "工作",
|
|
|
+ slot: "work",
|
|
|
+ width: 300,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
label: "完成率",
|
|
|
slot: "completionRate",
|
|
|
width: 120,
|
|
@@ -467,92 +536,6 @@ const config = computed(() => {
|
|
|
align: "center",
|
|
|
fixed: "right",
|
|
|
},
|
|
|
- // 渲染 el-button,一般用在最后一列。
|
|
|
- renderHTML(row) {
|
|
|
- return !props.isShowSelect
|
|
|
- ? [
|
|
|
- row.isCustomized == 1 &&
|
|
|
- (row.bomStatus == 0 || row.bomStatus == null)
|
|
|
- ? {
|
|
|
- attrs: {
|
|
|
- label: "调整BOM",
|
|
|
- type: "primary",
|
|
|
- text: true,
|
|
|
- },
|
|
|
- el: "button",
|
|
|
- click() {
|
|
|
- getDtl(row, false);
|
|
|
- },
|
|
|
- }
|
|
|
- : {},
|
|
|
- row.isCustomized == 1 && row.bomStatus
|
|
|
- ? {
|
|
|
- attrs: {
|
|
|
- label: "查看BOM",
|
|
|
- type: "primary",
|
|
|
- text: true,
|
|
|
- },
|
|
|
- el: "button",
|
|
|
- click() {
|
|
|
- getDtl(row, true);
|
|
|
- },
|
|
|
- }
|
|
|
- : {},
|
|
|
- row.isCustomized == 1 &&
|
|
|
- (row.technologyStatus == 0 || row.technologyStatus == null)
|
|
|
- ? {
|
|
|
- attrs: {
|
|
|
- label: "调整工艺",
|
|
|
- type: "primary",
|
|
|
- text: true,
|
|
|
- },
|
|
|
- el: "button",
|
|
|
- click() {
|
|
|
- getDtlOne(row, false);
|
|
|
- },
|
|
|
- }
|
|
|
- : {},
|
|
|
- row.isCustomized == 1 && row.technologyStatus
|
|
|
- ? {
|
|
|
- attrs: {
|
|
|
- label: "查看工艺",
|
|
|
- type: "primary",
|
|
|
- text: true,
|
|
|
- },
|
|
|
- el: "button",
|
|
|
- click() {
|
|
|
- getDtlOne(row, true);
|
|
|
- },
|
|
|
- }
|
|
|
- : {},
|
|
|
- row.productionQuantity == null
|
|
|
- ? {
|
|
|
- attrs: {
|
|
|
- label: "下发",
|
|
|
- type: "primary",
|
|
|
- text: true,
|
|
|
- },
|
|
|
- el: "button",
|
|
|
- click() {
|
|
|
- handleOut(row);
|
|
|
- },
|
|
|
- }
|
|
|
- : {},
|
|
|
- ]
|
|
|
- : [
|
|
|
- {
|
|
|
- attrs: {
|
|
|
- label: "选择",
|
|
|
- type: "primary",
|
|
|
- text: true,
|
|
|
- },
|
|
|
- el: "button",
|
|
|
- click() {
|
|
|
- handleSelectRow(row);
|
|
|
- },
|
|
|
- },
|
|
|
- ];
|
|
|
- },
|
|
|
},
|
|
|
];
|
|
|
});
|
|
@@ -686,17 +669,35 @@ const openModal = () => {
|
|
|
formData.data = {};
|
|
|
};
|
|
|
|
|
|
-const submitForm = (type) => {
|
|
|
+const submitForm = (flag) => {
|
|
|
byform.value.handleSubmit((valid) => {
|
|
|
- if (type == 1) {
|
|
|
+ let type = "";
|
|
|
+ if (submitType.value == 1) {
|
|
|
+ type = 1;
|
|
|
+ } else if (submitType.value == 2) {
|
|
|
+ type = 2;
|
|
|
+ }
|
|
|
+ formData.data.type = type;
|
|
|
+ if (flag == 1) {
|
|
|
ElMessageBox.confirm(`你确定提交吗?`, "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning",
|
|
|
}).then(() => {
|
|
|
- formData.data.bomStatus = type;
|
|
|
+ if (submitType.value == 1) {
|
|
|
+ formData.data.bomStatus = 1;
|
|
|
+ } else if (submitType.value == 2) {
|
|
|
+ formData.data.electricianBomStatus = 1;
|
|
|
+ } else {
|
|
|
+ formData.data.researchBomStatus = 1;
|
|
|
+ }
|
|
|
+ const arr = [
|
|
|
+ ...formData.data.workOrderBomList,
|
|
|
+ ...formData.data.workOrderBomListOne,
|
|
|
+ ];
|
|
|
+ formData.data.workOrderBomList = arr;
|
|
|
submitLoading.value = true;
|
|
|
- proxy.post("/workOrderBom/edit", formData.data).then(
|
|
|
+ proxy.post("/workOrder/editBom", formData.data).then(
|
|
|
(res) => {
|
|
|
ElMessage({
|
|
|
message: "操作成功",
|
|
@@ -710,9 +711,8 @@ const submitForm = (type) => {
|
|
|
);
|
|
|
});
|
|
|
} else {
|
|
|
- // formData.data.bomStatus = type;
|
|
|
submitLoading.value = true;
|
|
|
- proxy.post("/workOrderBom/edit", formData.data).then(
|
|
|
+ proxy.post("/workOrder/editBom", formData.data).then(
|
|
|
(res) => {
|
|
|
ElMessage({
|
|
|
message: "操作成功",
|
|
@@ -789,21 +789,32 @@ const submitFormOne = (type) => {
|
|
|
});
|
|
|
};
|
|
|
const isDetail = ref(false);
|
|
|
-const getDtl = (row, flag) => {
|
|
|
+const submitType = ref("all");
|
|
|
+const getDtl = (row, flag, submit) => {
|
|
|
+ submitType.value = submit;
|
|
|
isDetail.value = flag;
|
|
|
- // formOption.disabled = flag;
|
|
|
modalType.value = "edit";
|
|
|
proxy.post("/workOrderBom/list", { workOrderId: row.id }).then((res) => {
|
|
|
- formData.data = {
|
|
|
- workOrderBomList: res,
|
|
|
- workOrderId: row.id,
|
|
|
- };
|
|
|
- dialogVisible.value = true;
|
|
|
+ if (res && res.length > 0) {
|
|
|
+ // 五金
|
|
|
+ let workOrderBomList = res.filter((x) => x.type == 1);
|
|
|
+ let workOrderBomListOne = res.filter((x) => x.type == 2);
|
|
|
+ formData.data = {
|
|
|
+ workOrderBomList: workOrderBomList,
|
|
|
+ workOrderBomListOne: workOrderBomListOne,
|
|
|
+ workOrderId: row.id,
|
|
|
+ };
|
|
|
+ dialogVisible.value = true;
|
|
|
+ }
|
|
|
});
|
|
|
};
|
|
|
|
|
|
-const handleRemove = (index) => {
|
|
|
- formData.data.workOrderBomList.splice(index, 1);
|
|
|
+const handleRemove = (index, type) => {
|
|
|
+ if (type == 1) {
|
|
|
+ formData.data.workOrderBomList.splice(index, 1);
|
|
|
+ } else {
|
|
|
+ formData.data.workOrderBomListOne.splice(index, 1);
|
|
|
+ }
|
|
|
};
|
|
|
// 对el-table进行拖拽排序
|
|
|
const initSort = () => {
|
|
@@ -911,24 +922,48 @@ const checkShow = () => {
|
|
|
checkShow();
|
|
|
getList();
|
|
|
getDict();
|
|
|
+const selectType = ref(-1);
|
|
|
+const clickSelect = (type) => {
|
|
|
+ selectType.value = type;
|
|
|
+ openMaterial.value = true;
|
|
|
+};
|
|
|
|
|
|
const handleSelect = (row) => {
|
|
|
- const flag = formData.data.workOrderBomList.some(
|
|
|
- (x) => x.productId === row.id
|
|
|
- );
|
|
|
- if (flag)
|
|
|
- return ElMessage({
|
|
|
- message: "该物料已选择",
|
|
|
- type: "info",
|
|
|
+ if (selectType.value == 1) {
|
|
|
+ const flag = formData.data.workOrderBomList.some(
|
|
|
+ (x) => x.productId === row.id
|
|
|
+ );
|
|
|
+ if (flag)
|
|
|
+ return ElMessage({
|
|
|
+ message: "该物料已选择",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ formData.data.workOrderBomList.push({
|
|
|
+ productId: row.id,
|
|
|
+ productCode: row.code,
|
|
|
+ productName: row.name,
|
|
|
+ productSpec: row.spec,
|
|
|
+ productUnit: row.unit,
|
|
|
+ quantity: null,
|
|
|
});
|
|
|
- formData.data.workOrderBomList.push({
|
|
|
- productId: row.id,
|
|
|
- productCode: row.code,
|
|
|
- productName: row.name,
|
|
|
- productSpec: row.spec,
|
|
|
- productUnit: row.unit,
|
|
|
- quantity: null,
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ const flag = formData.data.workOrderBomListOne.some(
|
|
|
+ (x) => x.productId === row.id
|
|
|
+ );
|
|
|
+ if (flag)
|
|
|
+ return ElMessage({
|
|
|
+ message: "该物料已选择",
|
|
|
+ type: "info",
|
|
|
+ });
|
|
|
+ formData.data.workOrderBomListOne.push({
|
|
|
+ productId: row.id,
|
|
|
+ productCode: row.code,
|
|
|
+ productName: row.name,
|
|
|
+ productSpec: row.spec,
|
|
|
+ productUnit: row.unit,
|
|
|
+ quantity: null,
|
|
|
+ });
|
|
|
+ }
|
|
|
return ElMessage({
|
|
|
message: "选择成功",
|
|
|
type: "success",
|
|
@@ -1115,12 +1150,14 @@ const handleSelectRow = (row) => {
|
|
|
}
|
|
|
|
|
|
.active {
|
|
|
- background: #a6dd82;
|
|
|
+ background: #98db6b;
|
|
|
color: #fff;
|
|
|
border-radius: 4px;
|
|
|
}
|
|
|
.disActive {
|
|
|
- background: #fa9841;
|
|
|
+ // background: #fa9841;
|
|
|
+ background: #c4c4c4;
|
|
|
border-radius: 4px;
|
|
|
+ color: #fff;
|
|
|
}
|
|
|
</style>
|