소스 검색

1、床垫报价新建辅料tab增加"增行" "删行"按钮

MY 3 일 전
부모
커밋
40a2bc4104
2개의 변경된 파일59개의 추가작업 그리고 7개의 파일을 삭제
  1. 27 5
      JLHWEB/src/views/quote/mattressQuote/detail.vue
  2. 32 2
      JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

+ 27 - 5
JLHWEB/src/views/quote/mattressQuote/detail.vue

@@ -466,12 +466,14 @@
         :extra-loading="mxLoading"
         :footer-method="footerMethod"
       >
-        <!-- <template #tableHeader>
+        <template #tableHeader>
           <el-space wrap>
-            <el-button type="primary">{{ $t("common.addText") }}</el-button>
-            <el-button type="danger">{{ $t("common.delText") }}</el-button>
+            <el-button type="primary" @click="funcAddMtrlMx({}, null, 'accessoriesMxRef', -1)">{{
+              $t("common.addText")
+            }}</el-button>
+            <el-button type="danger" @click="toDelMx_accessories">{{ $t("common.delText") }}</el-button>
           </el-space>
-        </template> -->
+        </template>
       </LjVxeTable>
     </template>
 
@@ -939,7 +941,8 @@ const {
   gotoErpapi,
   updateSubspecsTable,
   autoLoadExtraData,
-  autoLoadExtraData_chai
+  autoLoadExtraData_chai,
+  getAllFormulaList
 } = useHooks(t);
 const { toExcelQuote, toExcelQuoteNew } = useHooksCpQuote();
 const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
@@ -2331,6 +2334,7 @@ onMounted(() => {
   console.log("defaultColumnsValue.value :>> ", route.query?.deptid, defaultColumnsValue.value);
 
   getFormulakindEnum();
+  getAllFormulaList();
 });
 
 /**
@@ -2920,6 +2924,24 @@ const SetCurrentTabs = (data: any) => {
   globalStore.setGlobalState("mattresTabs", _dftabs);
 };
 
+
+/**
+ * @description 删除辅料
+ */
+const toDelMx_accessories = () => {
+  const { $table, curRecords } = getCurrentRecords(accessoriesMxRef.value);
+  if ($table) {
+    if (curRecords.length) {
+      try {
+        $table.remove(curRecords);
+      } catch (error) {
+        ElMessage.error(error.message);
+        return false;
+      }
+    }
+  }
+};
+
 /**
  * @description 新增主副规格
  */

+ 32 - 2
JLHWEB/src/views/quote/mattressQuote/hooks/index.tsx

@@ -138,6 +138,10 @@ interface defaultState {
   isShowOriginFormulaMattress: boolean;
   columnsMx_subSpecs_dis: any[];
   subSpecsData: any[];
+  /**
+   * @description 记录需要的公式
+   */
+  mattressFormulaList: any[];
 }
 
 interface bednetDrawerPropsdata {
@@ -407,7 +411,8 @@ export const useHooks = (t?: any) => {
     additionalCostsEnum: [],
     isShowOriginFormulaMattress: false,
     columnsMx_subSpecs_dis: [],
-    subSpecsData: []
+    subSpecsData: [],
+    mattressFormulaList: []
   });
 
   const router = useRouter();
@@ -1895,6 +1900,17 @@ export const useHooks = (t?: any) => {
           qty: 1,
           dscrp: ""
         };
+      } else if (tgRefName === "accessoriesMxRef") {
+        const result = state.mattressFormulaList.find(item => item.formulatype === 2 && item.formulakind === 15);
+        records = {
+          mattressmxid: 0,
+          formulatype: 2,
+          if_mtrl: 2,
+          formula: "",
+          sortcode: "",
+          formulakind: 15,
+          formulaid: result.formulaid || 0
+        };
       } else {
         records = {
           addmx: "+",
@@ -6093,6 +6109,19 @@ export const useHooks = (t?: any) => {
     // }
   };
 
+  const getAllFormulaList = async () => {
+    const need_formula = [2];
+    let _param = {
+      dsname: "web_mattress_formulalist",
+      queryparams: {
+        arrg_usetype: 0,
+        arg_array_formulatype: need_formula
+      }
+    };
+    let res = await CommonDynamicSelect(_param);
+    state.mattressFormulaList = res.datatable;
+  };
+
   return {
     ...toRefs(state),
     columns,
@@ -6135,6 +6164,7 @@ export const useHooks = (t?: any) => {
     funcChaifenTabPro,
     getQuoteListMxData,
     autoLoadExtraData,
-    autoLoadExtraData_chai
+    autoLoadExtraData_chai,
+    getAllFormulaList
   };
 };