Browse Source

产品库

cz 1 year ago
parent
commit
175bdaa09f

+ 6 - 15
src/components/common-list.vue

@@ -3,30 +3,21 @@
     <ul>
       <li v-for="i in listData" :key="i.id">
         <div class="left-box" style="margin-right: 20px" v-if="isCheckbox">
-          <van-checkbox
-            v-model="i.checked"
-            icon-size="15px"
-            shape="square"
-            @change="listCheck"
-            :disabled="optionalValue ? optionalValue != i[optionalKey] : false"
-          ></van-checkbox>
+          <van-checkbox v-model="i.checked" icon-size="15px" shape="square" @change="listCheck"
+                        :disabled="optionalValue ? optionalValue != i[optionalKey] : false"></van-checkbox>
         </div>
         <p>
-          
+
         </p>
-        <div
-          class="center-content"
-          style="line-height: 24px"
-          @click="listCk(i)"
-        >
+        <div class="center-content" style="line-height: 24px" @click="listCk(i)">
           <div v-for="j in config" :key="j.prop" style="display: flex">
-            <span style="width:72px;">{{ j.label }}:</span>
+            <span style="min-width:80px;">{{ j.label }}:</span>
             <span v-if="j.type && j.type === 'slot'" style="flex: 1;">
               <slot :name="j.slotName" :row="i">
                 {{ j.slotName }}插槽占位符
               </slot>
             </span>
-            <span v-else  style="flex: 1;">
+            <span v-else style="flex: 1;">
               {{ i[j.prop] || ''}}
             </span>
           </div>

+ 22 - 0
src/router/index.js

@@ -514,6 +514,28 @@ const routes = [{
 				name: "标准产品库添加",
 				component: () => import("../views/product-material/standard-product-library/add.vue"),
 			},
+			// 尔泓公司产品库
+			{
+				path: "ehsdCompanyProduct",
+				name: "公司产品库",
+				component: () => import("../views/product-material/companyProduct/index.vue"),
+			},
+			{
+				path: "ehsdCompanyProductAdd",
+				name: "公司产品库详情",
+				component: () => import("../views/product-material/companyProduct/add.vue"),
+			},
+			// 尔泓客户产品库
+			{
+				path: "ehsdCustomProduct",
+				name: "客户产品库",
+				component: () => import("../views/product-material/customProduct/index.vue"),
+			},
+			{
+				path: "ehsdCustomProductAdd",
+				name: "客户产品库详情",
+				component: () => import("../views/product-material/customProduct/add.vue"),
+			},
 			{
 				path: "historyMessage",
 				name: "历史消息",

+ 2 - 3
src/router/routerLXF.js

@@ -1,6 +1,5 @@
 export function routesLXF() {
-  const routesLXF = [
-    {
+  const routesLXF = [{
       path: "materialClassification",
       name: "物料分类",
       component: () => import("../views/product-material/material-classification/index.vue"),
@@ -217,4 +216,4 @@ export function routesLXF() {
     },
   ];
   return routesLXF;
-}
+}

+ 298 - 0
src/views/product-material/companyProduct/add.vue

@@ -0,0 +1,298 @@
+<template>
+  <div class="form">
+    <van-nav-bar :title="'公司产品库'" :left-text="$t('common.back')" left-arrow @click-left="onClickLeft">
+    </van-nav-bar>
+
+    <testForm v-model="formData.data" :formOption="formOption" :formConfig="formConfig" :rules="rules" @onSubmit="onSubmit" ref="formDom"></testForm>
+  </div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted, reactive } from "vue";
+import { showSuccessToast, showToast } from "vant";
+import { useRoute } from "vue-router";
+import { getUserInfo } from "@/utils/auth";
+import testForm from "@/components/testForm/index.vue";
+const proxy = getCurrentInstance().proxy;
+const route = useRoute();
+const show = ref(false);
+const typeModal = ref(false);
+const unitModal = ref(false);
+const classification = ref([]);
+const formData = reactive({
+  data: {},
+});
+const formDom = ref(null);
+const formOption = reactive({
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  hiddenSubmitBtn: false,
+});
+const formConfig = reactive([
+  {
+    type: "cascader",
+    label: proxy.t("productLibrary.productClassification"),
+    prop: "productClassifyId",
+    itemType: "common",
+    showPicker: false,
+    // data: classification.value,
+    data: [],
+    fieldNames: {
+      text: "label",
+      value: "id",
+      children: "children",
+    },
+    // onChangeFn: (option) => {
+    //   // console.log("aa");
+    // },
+    // finishFn: (current, option) => {
+    //   current.showPicker = false;
+    // },
+  },
+
+  {
+    type: "input",
+    itemType: "text",
+    label: proxy.t("productLibrary.productName"),
+    prop: "name",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "英文名",
+    prop: "nameEnglish",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: proxy.t("productLibrary.specificationModel"),
+    prop: "spec",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "销售指导价",
+    prop: "price",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "成本价",
+    prop: "costPrice",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "长(cm)",
+    prop: "productLong",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "宽(cm)",
+    prop: "productWide",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "高(cm)",
+    prop: "productHigh",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "净重(kg)",
+    prop: "netWeight",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "内包装方式",
+    prop: "innerPackMethod",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "外包装方式",
+    prop: "outerPackMethod",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "海关编码",
+    prop: "hsCode",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "textarea",
+    label: proxy.t("productLibrary.remarks"),
+    prop: "remark",
+  },
+  {
+    type: "upload",
+    label: proxy.t("productLibrary.fileUpload"),
+    prop: "fileList",
+  },
+]);
+const rules = {
+  productClassifyId: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.productClassificationCanNotBeEmpty"),
+    },
+  ],
+  type: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.productTypeCanNotBeEmpty"),
+    },
+  ],
+  name: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.productNameCanNotBeEmpty"),
+    },
+  ],
+  spec: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.specificationModelCanNotBeEmpty"),
+    },
+  ],
+  unit: [
+    { required: true, message: proxy.t("productLibrary.unitCanNotBeEmpty") },
+  ],
+  select: [{ required: true, message: proxy.t("productLibrary.pleaseSelect") }],
+  date: [
+    { required: true, message: proxy.t("productLibrary.pleaseSelectTime") },
+  ],
+  common: [
+    { required: true, message: proxy.t("productLibrary.pleaseSelectCascader") },
+  ],
+  // city: [{ required: true, message: "请选择城市" }],
+};
+const unitList = ref([]);
+const innerMethon = ref([]);
+const outsideMethon = ref([]);
+const getDict = async () => {
+  proxy
+    .post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
+    .then((res) => {
+      formConfig[0].data = res.data;
+    });
+  const res = await proxy.getDictOne([
+    "inner_packaging_method_ehsd",
+    "outside_packaging_method_ehsd",
+    "unit",
+  ]);
+  innerMethon.value = res["inner_packaging_method_ehsd"].data.map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+  outsideMethon.value = res["outside_packaging_method_ehsd"].data.map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+  formConfig[4].data = res["unit"].data.map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+
+  if (route.query.id) {
+    formOption.readonly = true;
+    formOption.hiddenSubmitBtn = true;
+    proxy
+      .post("/productInfo/detailByEhsd", { id: route.query.id })
+      .then((resDetail) => {
+        if (resDetail.data && resDetail.data.ehsdJson) {
+          let obj = JSON.parse(resDetail.data.ehsdJson);
+          formData.data = {
+            ...resDetail.data,
+            ...obj,
+          };
+          if (formData.data.innerPackMethod) {
+            formData.data.innerPackMethod = formData.data.innerPackMethod
+              .split(",")
+              .map((x) => proxy.dictValueLabel(x, innerMethon.value));
+          } else {
+            formData.data.innerPackMethod = [];
+          }
+          if (formData.data.outerPackMethod) {
+            formData.data.outerPackMethod = formData.data.outerPackMethod
+              .split(",")
+              .map((x) => proxy.dictValueLabel(x, outsideMethon.value));
+          } else {
+            formData.data.outerPackMethod = [];
+          }
+        }
+      });
+    proxy
+      .post("/fileInfo/getList", { businessIdList: [route.query.id] })
+      .then((res) => {
+        if (res.data[route.query.id] && res.data[route.query.id].length > 0) {
+          setTimeout(() => {
+            formData.data.fileList = res.data[route.query.id].map((item) => {
+              return {
+                ...item,
+                url: item.fileUrl,
+              };
+            });
+          }, 1000);
+        } else {
+          formData.data.fileList = [];
+        }
+      });
+  } else {
+  }
+};
+getDict();
+const onClickLeft = () => history.back();
+const onSubmit = () => {
+  console.log(formData);
+  formData.data.definition = "1";
+  formData.data.fileList = formData.data.fileList.map((item) => {
+    return {
+      url: item.url,
+      id: item.id,
+      fileName: item.fileName,
+    };
+  });
+  proxy.post("/productInfo/" + route.query.type, formData.data).then(() => {
+    showSuccessToast(
+      !route.query.id
+        ? proxy.t("common.addSuccess")
+        : proxy.t("common.modifySuccess")
+    );
+    setTimeout(() => {
+      history.back();
+    }, 500);
+  });
+};
+const treeToList = (arr) => {
+  let res = []; // 用于存储递归结果(扁平数据)
+  // 递归函数
+  let fn = (source) => {
+    source.forEach((el) => {
+      res.push(el);
+      el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归
+    });
+  };
+  fn(arr);
+  return res;
+};
+</script>

+ 144 - 0
src/views/product-material/companyProduct/index.vue

@@ -0,0 +1,144 @@
+<template>
+  <van-nav-bar :title="'公司产品库'" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
+    <!-- <template #right> {{$t('common.add')}} </template> -->
+  </van-nav-bar>
+  <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="onLoad" style="margin-bottom: 60px">
+        <commonList :data="listData" @onClick="toDtl" :config="listConfig"></commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+  <script setup>
+import { ref, getCurrentInstance } from "vue";
+import commonList from "@/components/common-list.vue";
+import { useRoute } from "vue-router";
+
+const loading = ref(false);
+const router = useRoute();
+const req = ref({
+  pageNum: 1,
+  type: "",
+  productClassifyId: "",
+  keyword: "",
+  definition: "1",
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+const classification = ref([]);
+const listConfig = ref([
+  {
+    label: "产品编码",
+    prop: "code",
+  },
+  {
+    label: "产品名称",
+    prop: "name",
+  },
+  {
+    label: "产品尺寸",
+    prop: "size",
+  },
+  {
+    label: "销售指导价",
+    prop: "price",
+  },
+  {
+    label: "成本价",
+    prop: "costPrice",
+  },
+]);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const onLoad = () => {
+  // getClassification();
+  getList();
+};
+const onClickLeft = () => proxy.$router.push("/main/working");
+const onClickRight = () => {
+  proxy.$router.push({
+    path: "standardProductLibraryAdd",
+    query: {
+      type: "add",
+    },
+  });
+};
+proxy.uploadDdRightBtn(onClickRight, proxy.t("common.add"));
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "ehsdCompanyProductAdd",
+    query: {
+      id: row.id,
+      type: "edit",
+    },
+  });
+};
+const treeToList = (arr) => {
+  let res = []; // 用于存储递归结果(扁平数据)
+  // 递归函数
+  let fn = (source) => {
+    source.forEach((el) => {
+      res.push(el);
+      el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归
+    });
+  };
+  fn(arr);
+  return res;
+};
+const getClassification = () => {
+  if (classification.value && classification.value.length > 0) {
+    getList();
+  } else {
+    proxy
+      .post("/productClassify/tree", {
+        parentId: "",
+        name: "",
+        definition: "1",
+      })
+      .then((res) => {
+        classification.value = treeToList(res.data);
+        getList();
+      });
+  }
+};
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/productInfo/getConditionProductList", req.value)
+    .then((res) => {
+      res.data.rows = res.data.rows.map((item) => {
+        let obj = JSON.parse(item.ehsdJson);
+        return {
+          size: `${obj.productLong}cm*${obj.productWide}cm*${obj.productHigh}`,
+          ...item,
+          ...obj,
+        };
+      });
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch((err) => {
+      loading.value = false;
+    });
+};
+</script>
+  
+  <style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>
+  

+ 298 - 0
src/views/product-material/customProduct/add.vue

@@ -0,0 +1,298 @@
+<template>
+  <div class="form">
+    <van-nav-bar :title="'客户产品库'" :left-text="$t('common.back')" left-arrow @click-left="onClickLeft">
+    </van-nav-bar>
+
+    <testForm v-model="formData.data" :formOption="formOption" :formConfig="formConfig" :rules="rules" @onSubmit="onSubmit" ref="formDom"></testForm>
+  </div>
+</template>
+
+<script setup>
+import { ref, getCurrentInstance, onMounted, reactive } from "vue";
+import { showSuccessToast, showToast } from "vant";
+import { useRoute } from "vue-router";
+import { getUserInfo } from "@/utils/auth";
+import testForm from "@/components/testForm/index.vue";
+const proxy = getCurrentInstance().proxy;
+const route = useRoute();
+const show = ref(false);
+const typeModal = ref(false);
+const unitModal = ref(false);
+const classification = ref([]);
+const formData = reactive({
+  data: {},
+});
+const formDom = ref(null);
+const formOption = reactive({
+  readonly: false, //用于控制整个表单是否只读
+  disabled: false,
+  labelAlign: "top",
+  scroll: true,
+  labelWidth: "62pk",
+  hiddenSubmitBtn: false,
+});
+const formConfig = reactive([
+  {
+    type: "cascader",
+    label: proxy.t("productLibrary.productClassification"),
+    prop: "productClassifyId",
+    itemType: "common",
+    showPicker: false,
+    // data: classification.value,
+    data: [],
+    fieldNames: {
+      text: "label",
+      value: "id",
+      children: "children",
+    },
+    // onChangeFn: (option) => {
+    //   // console.log("aa");
+    // },
+    // finishFn: (current, option) => {
+    //   current.showPicker = false;
+    // },
+  },
+
+  {
+    type: "input",
+    itemType: "text",
+    label: proxy.t("productLibrary.productName"),
+    prop: "name",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "英文名",
+    prop: "nameEnglish",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: proxy.t("productLibrary.specificationModel"),
+    prop: "spec",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "销售指导价",
+    prop: "price",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "成本价",
+    prop: "costPrice",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "长(cm)",
+    prop: "productLong",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "宽(cm)",
+    prop: "productWide",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "高(cm)",
+    prop: "productHigh",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "净重(kg)",
+    prop: "netWeight",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "内包装方式",
+    prop: "innerPackMethod",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "text",
+    label: "外包装方式",
+    prop: "outerPackMethod",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "number",
+    label: "海关编码",
+    prop: "hsCode",
+    clearable: true,
+  },
+  {
+    type: "input",
+    itemType: "textarea",
+    label: proxy.t("productLibrary.remarks"),
+    prop: "remark",
+  },
+  {
+    type: "upload",
+    label: proxy.t("productLibrary.fileUpload"),
+    prop: "fileList",
+  },
+]);
+const rules = {
+  productClassifyId: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.productClassificationCanNotBeEmpty"),
+    },
+  ],
+  type: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.productTypeCanNotBeEmpty"),
+    },
+  ],
+  name: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.productNameCanNotBeEmpty"),
+    },
+  ],
+  spec: [
+    {
+      required: true,
+      message: proxy.t("productLibrary.specificationModelCanNotBeEmpty"),
+    },
+  ],
+  unit: [
+    { required: true, message: proxy.t("productLibrary.unitCanNotBeEmpty") },
+  ],
+  select: [{ required: true, message: proxy.t("productLibrary.pleaseSelect") }],
+  date: [
+    { required: true, message: proxy.t("productLibrary.pleaseSelectTime") },
+  ],
+  common: [
+    { required: true, message: proxy.t("productLibrary.pleaseSelectCascader") },
+  ],
+  // city: [{ required: true, message: "请选择城市" }],
+};
+const unitList = ref([]);
+const innerMethon = ref([]);
+const outsideMethon = ref([]);
+const getDict = async () => {
+  proxy
+    .post("/productClassify/tree", { parentId: "", name: "", definition: "1" })
+    .then((res) => {
+      formConfig[0].data = res.data;
+    });
+  const res = await proxy.getDictOne([
+    "inner_packaging_method_ehsd",
+    "outside_packaging_method_ehsd",
+    "unit",
+  ]);
+  innerMethon.value = res["inner_packaging_method_ehsd"].data.map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+  outsideMethon.value = res["outside_packaging_method_ehsd"].data.map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+  formConfig[4].data = res["unit"].data.map((x) => ({
+    label: x.dictValue,
+    value: x.dictKey,
+  }));
+
+  if (route.query.id) {
+    formOption.readonly = true;
+    formOption.hiddenSubmitBtn = true;
+    proxy
+      .post("/productInfo/detailByEhsd", { id: route.query.id })
+      .then((resDetail) => {
+        if (resDetail.data && resDetail.data.ehsdJson) {
+          let obj = JSON.parse(resDetail.data.ehsdJson);
+          formData.data = {
+            ...resDetail.data,
+            ...obj,
+          };
+          if (formData.data.innerPackMethod) {
+            formData.data.innerPackMethod = formData.data.innerPackMethod
+              .split(",")
+              .map((x) => proxy.dictValueLabel(x, innerMethon.value));
+          } else {
+            formData.data.innerPackMethod = [];
+          }
+          if (formData.data.outerPackMethod) {
+            formData.data.outerPackMethod = formData.data.outerPackMethod
+              .split(",")
+              .map((x) => proxy.dictValueLabel(x, outsideMethon.value));
+          } else {
+            formData.data.outerPackMethod = [];
+          }
+        }
+      });
+    proxy
+      .post("/fileInfo/getList", { businessIdList: [route.query.id] })
+      .then((res) => {
+        if (res.data[route.query.id] && res.data[route.query.id].length > 0) {
+          setTimeout(() => {
+            formData.data.fileList = res.data[route.query.id].map((item) => {
+              return {
+                ...item,
+                url: item.fileUrl,
+              };
+            });
+          }, 1000);
+        } else {
+          formData.data.fileList = [];
+        }
+      });
+  } else {
+  }
+};
+getDict();
+const onClickLeft = () => history.back();
+const onSubmit = () => {
+  console.log(formData);
+  formData.data.definition = "1";
+  formData.data.fileList = formData.data.fileList.map((item) => {
+    return {
+      url: item.url,
+      id: item.id,
+      fileName: item.fileName,
+    };
+  });
+  proxy.post("/productInfo/" + route.query.type, formData.data).then(() => {
+    showSuccessToast(
+      !route.query.id
+        ? proxy.t("common.addSuccess")
+        : proxy.t("common.modifySuccess")
+    );
+    setTimeout(() => {
+      history.back();
+    }, 500);
+  });
+};
+const treeToList = (arr) => {
+  let res = []; // 用于存储递归结果(扁平数据)
+  // 递归函数
+  let fn = (source) => {
+    source.forEach((el) => {
+      res.push(el);
+      el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归
+    });
+  };
+  fn(arr);
+  return res;
+};
+</script>

+ 149 - 0
src/views/product-material/customProduct/index.vue

@@ -0,0 +1,149 @@
+<template>
+  <van-nav-bar :title="'客户产品库'" left-text="" left-arrow @click-left="onClickLeft" @click-right="onClickRight">
+    <!-- <template #right> {{$t('common.add')}} </template> -->
+  </van-nav-bar>
+  <van-search v-model="req.keyword" :placeholder="$t('common.pleaseEnterKeywords')" @search="onRefresh" />
+  <van-pull-refresh v-model="loading" @refresh="onRefresh">
+    <div class="list">
+      <van-list v-model:loading="loading" :finished="finished" :finished-text="$t('common.noMore')" @load="onLoad" style="margin-bottom: 60px">
+        <commonList :data="listData" @onClick="toDtl" :config="listConfig"></commonList>
+      </van-list>
+    </div>
+  </van-pull-refresh>
+</template>
+  <script setup>
+import { ref, getCurrentInstance } from "vue";
+import commonList from "@/components/common-list.vue";
+import { useRoute } from "vue-router";
+
+const loading = ref(false);
+const router = useRoute();
+const req = ref({
+  pageNum: 1,
+  type: "",
+  productClassifyId: "",
+  keyword: "",
+  definition: "1",
+  customerId: "",
+});
+const finished = ref(false);
+const proxy = getCurrentInstance().proxy;
+const listData = ref([]);
+const classification = ref([]);
+const listConfig = ref([
+  {
+    label: "客户名称",
+    prop: "customerName",
+  },
+  {
+    label: "产品编码",
+    prop: "code",
+  },
+  {
+    label: "产品名称",
+    prop: "name",
+  },
+  {
+    label: "产品尺寸",
+    prop: "size",
+  },
+  {
+    label: "销售指导价",
+    prop: "price",
+  },
+  {
+    label: "成本价",
+    prop: "costPrice",
+  },
+]);
+const onRefresh = () => {
+  req.value.pageNum = 1;
+  finished.value = false;
+  getList("refresh");
+};
+const onLoad = () => {
+  // getClassification();
+  getList();
+};
+const onClickLeft = () => proxy.$router.push("/main/working");
+const onClickRight = () => {
+  proxy.$router.push({
+    path: "standardProductLibraryAdd",
+    query: {
+      type: "add",
+    },
+  });
+};
+proxy.uploadDdRightBtn(onClickRight, proxy.t("common.add"));
+const toDtl = (row) => {
+  proxy.$router.push({
+    path: "ehsdCustomProductAdd",
+    query: {
+      id: row.id,
+      type: "edit",
+    },
+  });
+};
+const treeToList = (arr) => {
+  let res = []; // 用于存储递归结果(扁平数据)
+  // 递归函数
+  let fn = (source) => {
+    source.forEach((el) => {
+      res.push(el);
+      el.children && el.children.length > 0 ? fn(el.children) : ""; // 子级递归
+    });
+  };
+  fn(arr);
+  return res;
+};
+const getClassification = () => {
+  if (classification.value && classification.value.length > 0) {
+    getList();
+  } else {
+    proxy
+      .post("/productClassify/tree", {
+        parentId: "",
+        name: "",
+        definition: "1",
+      })
+      .then((res) => {
+        classification.value = treeToList(res.data);
+        getList();
+      });
+  }
+};
+const getList = (type) => {
+  loading.value = true;
+  proxy
+    .post("/productInfo/getCustomerProductList", req.value)
+    .then((res) => {
+      res.data.rows = res.data.rows.map((item) => {
+        let obj = JSON.parse(item.ehsdJson);
+        return {
+          size: `${obj.productLong}cm*${obj.productWide}cm*${obj.productHigh}`,
+          ...item,
+          ...obj,
+        };
+      });
+      listData.value =
+        type === "refresh"
+          ? res.data.rows
+          : listData.value.concat(res.data.rows);
+      if (req.value.pageNum * 10 >= res.data.total) {
+        finished.value = true;
+      }
+      req.value.pageNum++;
+      loading.value = false;
+    })
+    .catch((err) => {
+      loading.value = false;
+    });
+};
+</script>
+  
+  <style lang="scss" scoped>
+.list {
+  min-height: 70vh;
+}
+</style>
+