cz 1 tahun lalu
induk
melakukan
8ba2d23527

+ 10 - 51
src/components/product/treeList.vue

@@ -4,13 +4,7 @@
       {{ title }}
     </div>
     <div class="search">
-      <el-input
-        v-model="search"
-        placeholder="请输入搜索内容"
-        clearable
-        @clear="search = ''"
-        @keyup.enter="searchChange"
-      ></el-input>
+      <el-input v-model="search" placeholder="请输入搜索内容" clearable @clear="search = ''" @keyup.enter="searchChange"></el-input>
       <!-- <el-button type="primary" @click="searchChange">搜索</el-button> -->
       <el-button type="primary" plain @click="add({ id: 0 })">
         <el-icon :size="20">
@@ -19,40 +13,21 @@
       </el-button>
     </div>
     <div class="box">
-      <el-tree
-        :data="data"
-        ref="tree"
-        node-key="id"
-        @node-click="treeChange"
-        default-expand-all
-        :expand-on-click-node="false"
-        :filter-node-method="filterNode"
-        :current-node-key="1"
-      >
+      <!-- default-expand-all 默认展开 -->
+      <el-tree :data="data" ref="tree" node-key="id" @node-click="treeChange" :expand-on-click-node="false" :filter-node-method="filterNode"
+               :current-node-key="1">
         <template #default="{ node, data }">
           <div class="custom-tree-node">
             <div style="flex: 1">{{ node.label }}</div>
             <!-- v-show="activeNode == data.id" -->
-            <div
-              class="icon-warp"
-              style="float: right; width: 71px; margin-left: 10px"
-              v-if="node.label != '全部'"
-            >
+            <div class="icon-warp" style="float: right; width: 71px; margin-left: 10px" v-if="node.label != '全部'">
               <el-icon :size="17" @click.stop="() => edit(node, data)">
                 <Edit />
               </el-icon>
-              <el-icon
-                :size="17"
-                style="margin-left: 10px"
-                @click.stop="() => add(data)"
-              >
+              <el-icon :size="17" style="margin-left: 10px" @click.stop="() => add(data)">
                 <Plus />
               </el-icon>
-              <el-icon
-                :size="17"
-                style="margin-left: 10px"
-                @click.stop="() => del(data)"
-              >
+              <el-icon :size="17" style="margin-left: 10px" @click.stop="() => del(data)">
                 <Delete />
               </el-icon>
             </div>
@@ -61,28 +36,12 @@
       </el-tree>
     </div>
 
-    <el-dialog
-      :title="treeModalType == 'add' ? '添加分类' : '编辑分类'"
-      v-model="treeModal"
-      width="400"
-      v-loading="loading"
-    >
-      <byForm
-        :formConfig="formConfig"
-        :formOption="formOption"
-        v-model="formData.data"
-        :rules="rules"
-        ref="byform"
-      >
+    <el-dialog :title="treeModalType == 'add' ? '添加分类' : '编辑分类'" v-model="treeModal" width="400" v-loading="loading">
+      <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="byform">
       </byForm>
       <template #footer>
         <el-button @click="treeModal = false" size="large">取 消</el-button>
-        <el-button
-          type="primary"
-          v-no-double-click="submitForm"
-          size="large"
-          :loading="submitLoading"
-        >
+        <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading">
           确 定
         </el-button>
       </template>

+ 125 - 54
src/views/JXSK/production/bom/index.vue

@@ -3,10 +3,7 @@
     <!-- <Banner /> -->
     <div class="content">
       <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row
-               :selectConfig="selectConfig" :table-events="{
-          //element talbe事件都能传
-          select: select,
-        }" :action-list="[
+               :selectConfig="selectConfig" :table-events="{select: select,}" :action-list="[
           {
             text: '添加BOM',
             action: () => openModal('add'),
@@ -19,7 +16,7 @@
         </template>
       </byTable>
     </div>
-    <el-dialog :title="titleText" v-model="dialogVisible" width="70%" v-loading="submitLoading" destroy-on-close>
+    <el-dialog :title="titleText" 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 #slotFile>
           <div style="width: 100%">
@@ -37,11 +34,10 @@
           </div>
         </template>
         <template #slot>
-          <div style="width: 100%">
-            <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">
-              <el-table :data="formData.data.bomDetailList">
+          <div style="width: 100%;display:flex">
+            <div style="width:50%;padding-right:10px">
+              <el-button type="primary" plain @click="clickSelect(10)">添加物料/半成品(五金)</el-button>
+              <el-table :data="formData.data.bomDetailList" style="margin-top:15px">
                 <el-table-column prop="productCode" label="物料编码" />
                 <el-table-column prop="productName" label="物料名称" />
                 <el-table-column prop="productSpec" label="规格型号" />
@@ -64,11 +60,41 @@
                 </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,10)">删除</el-button>
                   </template>
                 </el-table-column>
               </el-table>
-            </el-form>
+            </div>
+            <div style="width:50%;padding-left:10px">
+              <el-button type="primary" plain @click="clickSelect(20)">添加物料/半成品(电控)</el-button>
+              <el-table :data="formData.data.bomDetailListOne" 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="'bomDetailListOne.' + $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="150">
+                  <template #default="{ row, $index }">
+                    <el-form-item :prop="'bomDetailListOne.' + $index + '.cost'" :rules="rules.cost" :inline-message="true">
+                      <el-input-number v-model="row.cost" :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,20)">删除</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+            </div>
           </div>
         </template>
       </byForm>
@@ -322,6 +348,7 @@ let formData = reactive({
     productId: "",
     addType: "1",
     bomDetailList: [],
+    bomDetailListOne: [],
   },
   data1: {
     productId: "",
@@ -401,6 +428,7 @@ const openModal = () => {
     productId: "",
     addType: "1",
     bomDetailList: [],
+    bomDetailListOne: [],
   };
   fileList.value = [];
   fileListCopy.value = [];
@@ -410,7 +438,13 @@ const submitForm = () => {
   byform.value.handleSubmit((valid) => {
     if (!formData.data.bomDetailList.length > 0) {
       return ElMessage({
-        message: "请添加物料/半成品",
+        message: "请添加物料/半成品(五金)",
+        type: "info",
+      });
+    }
+    if (!formData.data.bomDetailListOne.length > 0) {
+      return ElMessage({
+        message: "请添加物料/半成品(电控)",
         type: "info",
       });
     }
@@ -426,31 +460,33 @@ const submitForm = () => {
         type: "info",
       });
     }
-    proxy.$refs.tableForm.validate((vaild) => {
-      if (vaild) {
-        submitLoading.value = true;
-        formData.data.bomDetailList = formData.data.bomDetailList.map((x) => ({
-          productId: x.productId,
-          quantity: x.quantity,
-          cost: x.cost,
-        }));
-        proxy.post(`/bomInfo/${modalType.value}ByJxst`, formData.data).then(
-          (res) => {
-            ElMessage({
-              message: modalType.value == "add" ? "添加成功" : "编辑成功",
-              type: "success",
-            });
-            dialogVisible.value = false;
-            submitLoading.value = false;
-            getList();
-          },
-          (err) => {
-            formData.data.bomDetailList = [];
-            submitLoading.value = false;
-          }
-        );
+    submitLoading.value = true;
+    const arr = [
+      ...formData.data.bomDetailList,
+      ...formData.data.bomDetailListOne,
+    ];
+    formData.data.bomDetailList = arr.map((x) => ({
+      productId: x.productId,
+      quantity: x.quantity,
+      cost: x.cost,
+      type: x.type,
+    }));
+    proxy.post(`/bomInfo/${modalType.value}ByJxst`, formData.data).then(
+      (res) => {
+        ElMessage({
+          message: modalType.value == "add" ? "添加成功" : "编辑成功",
+          type: "success",
+        });
+        dialogVisible.value = false;
+        submitLoading.value = false;
+        getList();
+      },
+      (err) => {
+        formData.data.bomDetailList = [];
+        formData.data.bomDetailListOne = [];
+        submitLoading.value = false;
       }
-    });
+    );
   });
 };
 const byform1 = ref(null);
@@ -489,10 +525,12 @@ const getDtl = (row, type, isNew) => {
         addType: "2", //2为新建版本
         productId: res.productId,
         bomDetailList: [],
+        bomDetailListOne: [],
       };
     } else {
       titleText.value = openVersion.value ? "版本详情" : "编辑BOM";
-      res.bomDetailList = res.bomDetailVoList;
+      res.bomDetailList = res.bomDetailVoList.filter((x) => x.type == 1);
+      res.bomDetailListOne = res.bomDetailVoList.filter((x) => x.type == 2);
       formData.data = res;
     }
     dialogVisible.value = true;
@@ -504,31 +542,64 @@ const getDtl = (row, type, isNew) => {
       fileListCopy.value = [...fileList.value];
     });
 };
+const selectType = ref(-1);
+const clickSelect = (type) => {
+  selectType.value = type;
+  openMaterial.value = true;
+};
 
 const handleSelect = (row) => {
-  const flag = formData.data.bomDetailList.some((x) => x.productId === row.id);
-  if (flag)
-    return ElMessage({
-      message: "该物料已选择",
-      type: "info",
+  if (selectType.value == 10) {
+    const flag = formData.data.bomDetailList.some(
+      (x) => x.productId === row.id
+    );
+    if (flag)
+      return ElMessage({
+        message: "该物料已选择",
+        type: "info",
+      });
+    formData.data.bomDetailList.push({
+      productId: row.id,
+      productCode: row.code,
+      productName: row.name,
+      productSpec: row.spec,
+      productUnit: row.unit,
+      quantity: null,
+      cost: null,
+      type: "1",
     });
-  formData.data.bomDetailList.push({
-    productId: row.id,
-    productCode: row.code,
-    productName: row.name,
-    productSpec: row.spec,
-    productUnit: row.unit,
-    quantity: null,
-    cost: null,
-  });
+  } else {
+    const flag = formData.data.bomDetailListOne.some(
+      (x) => x.productId === row.id
+    );
+    if (flag)
+      return ElMessage({
+        message: "该物料已选择",
+        type: "info",
+      });
+    formData.data.bomDetailListOne.push({
+      productId: row.id,
+      productCode: row.code,
+      productName: row.name,
+      productSpec: row.spec,
+      productUnit: row.unit,
+      quantity: null,
+      cost: null,
+      type: "2",
+    });
+  }
   return ElMessage({
     message: "选择成功",
     type: "success",
   });
 };
 
-const handleRemove = (index) => {
-  formData.data.bomDetailList.splice(index, 1);
+const handleRemove = (index, type) => {
+  if (type == 10) {
+    formData.data.bomDetailList.splice(index, 1);
+  } else {
+    formData.data.bomDetailListOne.splice(index, 1);
+  }
   return ElMessage({
     message: "删除成功",
     type: "success",

+ 190 - 153
src/views/JXSK/production/workOrder/index.vue

@@ -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>

+ 5 - 5
src/views/JXSK/salesMange/contract/index.vue

@@ -546,11 +546,6 @@ const formConfig = computed(() => {
       },
     },
     {
-      type: "slot",
-      slotName: "products",
-      label: "合同明细",
-    },
-    {
       type: "select",
       prop: "devUserId",
       label: "研发负责人",
@@ -561,6 +556,11 @@ const formConfig = computed(() => {
         width: "100%",
       },
     },
+    {
+      type: "slot",
+      slotName: "products",
+      label: "合同明细",
+    },
   ];
 });
 const getList = async (req) => {