Browse Source

Merge branch 'dev0.3' of http://36.137.93.232:3000/hf/byte-sailing-new into dev0.3

lxf 1 year ago
parent
commit
f99a416d09
1 changed files with 52 additions and 18 deletions
  1. 52 18
      src/views/production/project/bom/index.vue

+ 52 - 18
src/views/production/project/bom/index.vue

@@ -45,6 +45,28 @@
         :rules="rules"
         ref="byform"
       >
+        <template #productSlot>
+          <div style="width: 100%">
+            <el-select
+              v-model="formData.data.productId"
+              placeholder="请选择"
+              :disabled="isDisabled"
+            >
+              <el-option
+                v-for="item in productData"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+                :disabled="item.disabled"
+              >
+                <span style="float: left"
+                  >{{ item.name }}
+                  <span v-if="item.disabled">( 该产品已有BOM )</span>
+                </span>
+              </el-option>
+            </el-select>
+          </div>
+        </template>
         <template #slot>
           <div style="width: 100%">
             <el-button type="primary" plain @click="openMaterial = true"
@@ -247,6 +269,7 @@ const selectConfig = reactive([
   //   ],
   // },
 ]);
+const isDisabled = ref(false);
 const config = computed(() => {
   return [
     {
@@ -438,24 +461,30 @@ const formOption = reactive({
 });
 const byform = ref(null);
 const formConfig = reactive([
+  // {
+  //   type: "select",
+  //   prop: "productId",
+  //   label: "产品名称",
+  //   required: true,
+  //   disabled: false,
+  //   isLoad: {
+  //     url: "/productInfo/page",
+  //     req: {
+  //       pageNum: 1,
+  //       pageSize: 9999,
+  //       definition: "1",
+  //     },
+  //     labelKey: "name",
+  //     labelVal: "id",
+  //     method: "post",
+  //     resUrl: "rows",
+  //   },
+  // },
   {
-    type: "select",
-    prop: "productId",
+    type: "slot",
+    slotName: "productSlot",
     label: "产品名称",
-    required: true,
-    disabled: false,
-    isLoad: {
-      url: "/productInfo/page",
-      req: {
-        pageNum: 1,
-        pageSize: 9999,
-        definition: "1",
-      },
-      labelKey: "name",
-      labelVal: "id",
-      method: "post",
-      resUrl: "rows",
-    },
+    prop: "productId",
   },
   {
     type: "slot",
@@ -512,7 +541,8 @@ const openModal = () => {
     addType: "1",
     bomDetailList: [],
   };
-  formConfig[0].disabled = false;
+  // formConfig[0].disabled = false;
+  isDisabled.value = false;
 };
 const submitForm = () => {
   byform.value.handleSubmit((valid) => {
@@ -575,7 +605,7 @@ const handleChangeVer = () => {
 };
 
 const getDtl = (row, type, isNew) => {
-  formConfig[0].disabled = true; //禁止修改产品信息
+  isDisabled.value = true; //禁止修改产品信息
   modalType.value = type;
   proxy.post("/bomInfo/detail", { id: row.id }).then((res) => {
     if (isNew) {
@@ -660,7 +690,11 @@ const changeRowData = (val) => {
 };
 
 const materialUnit = ref([]);
+const productData = ref([]);
 const getDict = () => {
+  proxy.post("/bomInfo/productList").then((res) => {
+    productData.value = res;
+  });
   proxy.getDictOne(["material_unit"]).then((res) => {
     materialUnit.value = res["material_unit"].map((x) => ({
       label: x.dictValue,