Переглянути джерело

Merge branch 'v3.0' into sit

snow 6 місяців тому
батько
коміт
6de0e21395

+ 2 - 0
.env.development

@@ -22,6 +22,8 @@ VITE_PROXY_USER_REAL = "http://stockinv.test241.wanyuhengtong.com"
 # 开发环境后端业务地址
 VITE_PROXY_DOMAIN_REAL = "http://stockinv.test241.wanyuhengtong.com"
 
+VITE_WORKORDER_REAL = "http://project.test241.wanyuhengtong.com"
+
 VITE_IS_PROD = true
 
 # 跳转结算地址

+ 3 - 0
.env.v3_pro

@@ -22,6 +22,9 @@ VITE_PROXY_USER_REAL = "http://cxinv.api.caixiao365.com"
 # 开发环境后端业务地址
 VITE_PROXY_DOMAIN_REAL = "http://cxinv.api.caixiao365.com"
 
+
+VITE_WORKORDER_REAL = "http://work.api.caixiao365.com"
+
 VITE_IS_PROD = true
 
 # 跳转采销地址

+ 1 - 1
src/api/InvoiceSaleSettings/commodityCost/index.ts

@@ -50,7 +50,7 @@ export const httpDetail = (data: object): ResponseType<IGoodDetail> => {
 };
 
 export const httpCatlist = (data: object): ResponseListType<ICateType> => {
-  return http.request("post", `${yewuApi}catquery`, { data });
+  return http.request("post", `${yewuApi}catlist`, { data });
 };
 
 //添加商品类目

+ 4 - 0
src/api/InvoiceSales/capitalClaim/index.ts

@@ -18,6 +18,10 @@ export const httpAdd = (data: object): ResponseType => {
 export const httpList = (data: object): ResponseType => {
   return http.request("post", `${yewuApi}orderpaylist`, { data });
 };
+
+export const httpDelete = (data: object): ResponseType => {
+  return http.request("post", `${yewuApi}orderPay/tradeDelete`, { data });
+};
 //详情
 export const httpInfo = (data: object): ResponseType => {
   return http.request("post", `${yewuApi}tradeinfo`, { data });

+ 5 - 2
src/api/user.ts

@@ -14,9 +14,12 @@ interface userType extends Promise<any> {
 export const getVerify = (): userType => {
   return http.request("get", "/captcha");
 };
+export const httpTransformCompany = (data = {}): userType => {
+  return http.request("post", `${yewuApi}/catlist`, { data });
+};
 
-export const httpTransformCompany = (data: object) => {
-  return http.request("post", `http://project.test241.wanyuhengtong.com/user/company/query`, { data });
+export const getCategories = (data = {}): userType => {
+  return http.request("post", `${yewuApi}/catlist`, { data });
 };
 
 // 登录

+ 1 - 0
src/components/PageContent/src/actions/action-delete.tsx

@@ -47,6 +47,7 @@ const ActionDelete = defineComponent({
         v-slots={{
           reference: () => (
             <el-button
+              style="margin-left:20px"
               class="reset-margin"
               link
               size="small"

+ 1 - 1
src/components/PageContent/src/page-content.tsx

@@ -89,7 +89,7 @@ const PageContent = defineComponent({
       } = contentConfig;
 
       const view = showPreview ? showPreview(row) : true;
-      const del = showPreview ? showDelete(row) : true;
+      const del = showDelete ? showDelete(row) : true;
       const noAction = (superUserNoAction && !isSuperUser.value) || !superUserNoAction;
       const noPerview = (superUserNoPerview && !isSuperUser.value) || !superUserNoPerview;
       const showPay = showPayTagFn ? showPayTagFn(row, powers) : true;

+ 11 - 8
src/components/RemoteSelect/src/remote-select.tsx

@@ -9,18 +9,14 @@ const RemoteSelect = defineComponent({
   emits: ["listChange", "itemChange", "itenDetail", "update:value", "inital", "clear"],
   setup(props, { emit, expose }) {
     const value = computed({
-      get() {
-        return props.value;
-      },
-      set(newVal) {
-        emit("update:value", newVal);
-      }
+      get() { return props.value; },
+      set(newVal) { emit("update:value", newVal); }
     });
 
-    const responseHandle = useResponseHandle();
+    const pageInfo = ref({ page: '1', size: '15' })
 
+    const responseHandle = useResponseHandle();
     const list = ref<Array<any>>([]);
-
     const loading = ref(false);
 
     async function initalData(params) {
@@ -29,6 +25,7 @@ const RemoteSelect = defineComponent({
       loading.value = true;
       const { code, data, message } = await api({
         ...params,
+        ...(props.loadMore ? pageInfo : {}),
         ...(props.proData ? props.proData() : {})
       });
       loading.value = false;
@@ -93,6 +90,11 @@ const RemoteSelect = defineComponent({
       initalData
     });
 
+
+    function onLoadmore(){
+      console.log('滚动到顶部')
+    }
+
     return () => (
       <ElSelect
         v-model={value.value}
@@ -106,6 +108,7 @@ const RemoteSelect = defineComponent({
         style={{
           wdith: props.width ? props.width + "px" : ""
         }}
+        v-select-loadmore="onLoadmore"
         onChange={val => {
           emit(
             "itemChange",

+ 3 - 0
src/components/RemoteSelect/src/types.ts

@@ -3,6 +3,9 @@ export const RemoteSelectProps = {
     type: Function as PropType<(param: any) => Promise<any>>,
     required: true
   },
+  loadMore: {
+    type: Boolean,
+  },
   value: {
     type: String
   },

+ 21 - 13
src/views/InvoiceSaleSettings/_component/finance-setting.vue

@@ -7,6 +7,7 @@ import RemoteSelect from "/@/components/RemoteSelect";
 import { useRoute, useRouter } from "vue-router";
 import { useResponseHandle } from "/@/hooks";
 import { ElForm } from "element-plus";
+import QueryCategory from "./query-category.vue"
 
 const remoteSelectRef = ref<any>(null);
 
@@ -120,7 +121,7 @@ function handleRelatedCategories() {
   });
 }
 
-function handleSelectCategory(category) {
+function handleSelectCategory(category, isInit) {
   if (!category) {
     formData.tax = "";
     formData.cat_name = "";
@@ -131,10 +132,12 @@ function handleSelectCategory(category) {
   formData.cat_name = cat_name;
   taxs.value = [...tax, "0%", "1%", "3%"];
 
-  formData.tax = "";
-  formData.addTax = "";
-  formData.inv_tag = "";
-  formData.is_discount = "";
+  if(!isInit){
+    formData.tax = "";
+    formData.addTax = "";
+    formData.inv_tag = "";
+    formData.is_discount = "";
+  }
 }
 
 //优惠政策改变清空增值税管理和汇率标识
@@ -150,10 +153,6 @@ const handleTaxChange = () => {
   formData.inv_tag = "";
 };
 
-function handleLabel(item) {
-  return item.merge_code + " / " + item.cat_name + "-" + item.short_name;
-}
-
 watch(
   () => formData.addTax,
   addTax => {
@@ -201,7 +200,7 @@ watch(
       formData.addTax = addTax;
     });
 
-    if (cgd_inv_cat_code && remoteSelectRef.value) {
+    if (Number(status) === 1 && cgd_inv_cat_code && remoteSelectRef.value) {
       const params = { cat_code: cgd_inv_cat_code };
       const result = await remoteSelectRef.value.initalData(params);
       if (!result || !Array.isArray(result)) return;
@@ -209,6 +208,9 @@ watch(
       taxs.value = [...tax, '0%','1%','3%'];
     }
 
+
+   
+
     if (Number(status) === 2 && remoteSelectRef.value) {
       const params = { cat_code: inv_cat_code };
       const result = await remoteSelectRef.value.initalData(params);
@@ -236,10 +238,9 @@ watch(
   >
     <div flex gap="1">
       <el-form-item label="商品类目设置" prop="cat_code" flex-1>
-        <RemoteSelect
+        <!-- <RemoteSelect
           ref="remoteSelectRef"
           w-full
-          is-root
           :api="httpCatlist"
           v-model="formData.cat_code"
           :getLabel="handleLabel"
@@ -249,8 +250,15 @@ watch(
           request-prop="cat_name"
           sub-label-prop="short_name"
           @item-change="handleSelectCategory"
+          loadMore
           @inital="code => (formData.cat_code = code)"
-        />
+        /> -->
+        <QueryCategory 
+            ref="remoteSelectRef"
+            v-model="formData.cat_code"
+            @change="handleSelectCategory"
+            classWrapper="finance-item"
+          />
       </el-form-item>
     </div>
 

+ 23 - 16
src/views/InvoiceSaleSettings/_component/procure-setting.vue

@@ -6,6 +6,7 @@ import { useResponseHandle } from "/@/hooks";
 import { useRoute } from "vue-router";
 import { ElForm } from "element-plus";
 import { httpCatlist, httpAdd } from "/@/api/InvoiceSaleSettings/commodityCost";
+import QueryCategory from "./query-category.vue"
 
 import { type DescriptionColumn } from "/@/components/BasicDescriptions";
 
@@ -68,38 +69,43 @@ function handleRelatedCategories() {
   });
 }
 
-function handleSelectCategory(category) {
+function handleSelectCategory(category, isInit) {
   if (!category) {
     formData.tax = "";
     formData.cat_name = "";
     return (taxs.value = []);
   }
 
-  const { tax, cat_name } = category;
+  const { tax, label } = category;
   taxs.value = [...tax, "0%", "1%", "3%"];
-  formData.cat_name = cat_name;
-  formData.tax = "";
-}
 
-function handleLabel(item) {
-  return item.merge_code + " / " + item.cat_name + "-" + item.short_name;
+  console.log(11, isInit)
+
+  if(!isInit){
+    formData.cat_name = label;
+    formData.tax = "";
+  }
 }
 
 watch(
   () => props.detail,
   async () => {
-    if (!props.detail) return;
+      if (!props.detail) return;
     const { inv_good_name, inv_cat_code, good_name, inv_tax, cgd_inv_tax, cgd_inv_cat_code } = props.detail;
 
     formData.inv_good_name = inv_good_name ? inv_good_name : good_name;
     formData.tax = inv_tax ? inv_tax * 100 + "%" : "";
 
+
     if (formData.inv_good_name.length > 70) {
       formData.inv_good_name = formData.inv_good_name.slice(0, 70);
     }
 
-    nextTick(async () => {
+    if (cgd_inv_tax) {
+        formData.tax = cgd_inv_tax;
+      }
 
+    nextTick(async () => {
       if (inv_cat_code && remoteSelectRef.value && inv_cat_code.trim().length !== 0) {
         const params = { cat_code: inv_cat_code };
         const result = await remoteSelectRef.value.initalData(params);
@@ -113,11 +119,6 @@ watch(
         const { tax } = result[0];
         taxs.value = [...tax, '0%','1%','3%'];
       }
-
-      if (cgd_inv_tax) {
-        formData.tax = cgd_inv_tax;
-      }
-
     })
   },
   {
@@ -130,11 +131,17 @@ watch(
   <el-form label-position="left" ref="formRef" :rules="dynamicRules" :model="formData">
     <div flex gap="1">
       <el-form-item label="商品类目设置" prop="cat_code" flex-1>
-        <RemoteSelect ref="remoteSelectRef" w-full is-root :getLabel="handleLabel" :api="httpCatlist"
+        <!-- <RemoteSelect w-full :getLabel="handleLabel" :api="httpCatlist"
           v-model="formData.cat_code" placeholder="请选择商品类目" response-label-prop="cat_name"
           response-val-prop="merge_code" request-prop="cat_name" sub-label-prop="short_name"
           @item-change="handleSelectCategory"
-          @inital="(_, { code, merge_code }) => (formData.cat_code = Number(detail.status) >= 1 ? merge_code : code)" />
+          @inital="(_, { code, merge_code }) => (formData.cat_code = Number(detail.status) >= 1 ? merge_code : code)" /> -->
+
+          <QueryCategory 
+            ref="remoteSelectRef"
+            v-model="formData.cat_code"
+            @change="handleSelectCategory"
+          />
       </el-form-item>
     </div>
 

+ 258 - 0
src/views/InvoiceSaleSettings/_component/query-category.vue

@@ -0,0 +1,258 @@
+<script setup lang="ts">
+import { useDebounceFn } from "@vueuse/core";
+import { ref, onMounted, reactive, onUnmounted, watch } from "vue";
+import { getCategories } from "/@/api/user";
+import { useResponseHandle } from "/@/hooks/core/useAsync";
+import { useCompany } from "/@/hooks/core/useCompany";
+import { useUserInfo } from "/@/hooks/core/useUser";
+
+import { useVModel } from "@vueuse/core"
+
+const emit = defineEmits(["change", "update:modelValue"]);
+
+
+const props = withDefaults(
+  defineProps<{
+    noAll?: boolean;
+    noSet?: boolean;
+    modelValue?: string;
+    isSupplier?: boolean;
+    placeholder?: string;
+    classWrapper?:string
+  }>(),
+  {
+    modelValue: "",
+    classWrapper: 'procure-item'
+  }
+);
+
+const value = useVModel(props, 'modelValue')
+
+
+const { setCurrentCompany } = useCompany();
+const responseHandle = useResponseHandle();
+
+const { userLevel } = useUserInfo();
+
+const selectRef = ref(null);
+const list = ref<any[]>([]);
+
+const state = reactive({
+  loading: false,
+  noMore: false,
+  name: "",
+  count: 0,
+  page: 1
+});
+
+let scrollWrapper: HTMLDivElement | null = null;
+
+const debouceScroll = useDebounceFn(handleScroll, 500);
+
+async function requesetSupplierAll(name: string) {
+  state.name = name;
+  state.page = 1;
+  state.noMore = false;
+  const api = getCategories
+  const { data, message, code } = await api({
+    cat_name: name,
+    size:10,
+    page: state.page
+  });
+
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      list.value = data.list.map(({ short_name, cat_name, merge_code,tax }) => ({
+        tax,
+        subTitle: short_name,
+        value: merge_code,
+        label: cat_name
+      }))
+
+      state.count = data.count;
+      state.loading = false;
+      const maxPage = Math.ceil(state.count / 10);
+      state.noMore = maxPage <= 1;
+    }
+  });
+}
+
+function handleChange(v) {
+  const item = list.value.find(({ value }) => v === value);
+  console.log(list.value, value, item)
+  emit("change", item);
+}
+
+async function handleScroll() {
+  const height = scrollWrapper?.clientHeight;
+  const scrollTop = scrollWrapper?.scrollTop;
+  const scrollHeight = scrollWrapper?.scrollHeight;
+
+  if (height + scrollTop >= scrollHeight && !state.noMore) {
+    state.page++;
+    state.loading = true;
+
+    const api = getCategories
+
+
+    const { data, message, code } = await api({
+      cat_name: state.name,
+      page: state.page,
+      size:10,
+      noRela: true
+    });
+
+    const pushCompany = (_list: any[]) => {
+      list.value = [...list.value, ..._list.map(({ short_name, cat_name, merge_code, tax }) => ({
+        tax,
+        subTitle: short_name,
+        value: merge_code,
+        label: cat_name
+      }))];
+    };
+
+    responseHandle({
+      code,
+      message,
+      handler: () => {
+        state.count = data.count;
+        const maxPage = Math.ceil(state.count / 10);
+
+        if (state.page > maxPage) {
+          state.noMore = true;
+          state.loading = false;
+          return;
+        }
+
+        pushCompany(data.list);
+      }
+    });
+  }
+}
+
+onMounted(() => {
+  setTimeout(() => {
+    const superItem = document.querySelector("." + props.classWrapper);
+    if (!superItem) return;
+    scrollWrapper = superItem.parentElement?.parentElement as HTMLDivElement;
+    if (scrollWrapper) {
+      scrollWrapper.addEventListener("scroll", debouceScroll, false);
+    }
+  }, 1000);
+});
+
+onUnmounted(() => {
+  state.loading = false;
+  state.noMore = false;
+  state.name = "";
+  state.page = 1;
+
+  if (scrollWrapper) {
+    scrollWrapper.removeEventListener("scroll", debouceScroll);
+  }
+});
+
+watch(
+  () => userLevel.value,
+  level => {
+    if (level !== "") {
+      state.loading = false;
+      state.noMore = false;
+      state.name = "";
+      state.page = 1;
+      list.value = [];
+      requesetSupplierAll(undefined);
+    }
+  }
+);
+
+const getLabel = company => {
+  const { value, label } = company;
+  return value + " / " + label;
+};
+
+
+
+const getLabel2 = company => {
+  const { value, label, subTitle } = company;
+  return value + " / " + label + '-' + subTitle;
+};
+
+
+requesetSupplierAll(undefined);
+
+
+defineExpose({
+  async initalData(params){
+    const { data, message, code } = await getCategories(params);
+
+    list.value = (data.list || []).map(({ tax, cat_name ,merge_code, short_name }) => ({
+      tax,
+      value: merge_code,
+      label: cat_name,
+      subTitle: short_name
+    }))
+
+    value.value = (list.value[0] || {}).value
+    emit('change', list.value[0], true)
+  }
+})
+
+</script>
+
+<template>
+  <ElSelect
+    filterable
+    remote
+    v-model="value"
+    :remote-method="requesetSupplierAll"
+    @change="handleChange"
+    style="width: 100%"
+    ref="selectRef"
+    placeholder="商品类目"
+  >
+    <ElOption
+      :class="classWrapper"
+      v-for="item in list"
+      :key="item.value"
+      :value="item.value"
+      :label="getLabel2(item)"
+    >
+      <span style="float: left">
+         {{getLabel(item)}}
+      </span>
+
+      <span style="float: right;color: var(--el-text-color-secondary);font-size: 13px;">
+        {{item.subTitle}}
+      </span>
+    </ElOption>
+
+    <p class="super-loading" v-if="state.loading">
+      <IconifyIconOffline class="animate-spin" icon="Loading" />
+      加载中
+    </p>
+
+    <p class="super-no-more" v-if="state.noMore">没有更多数据了...</p>
+  </ElSelect>
+</template>
+
+<style lang="scss" scoped>
+.super-no-more {
+  text-align: center;
+  color: #999;
+  font-size: 14px;
+  line-height: 38px;
+}
+
+.super-loading {
+  display: flex;
+  font-size: 14px;
+  justify-content: center;
+  align-items: center;
+  color: #999;
+  gap: 10px;
+  line-height: 38px;
+}
+</style>

+ 7 - 2
src/views/InvoiceSales/capitalClaim/config/content.config.ts

@@ -1,5 +1,5 @@
 import { ContentConfig } from "/@/components/PageContent";
-import { httpList } from "/@/api/InvoiceSales/capitalClaim";
+import { httpList, httpDelete } from "/@/api/InvoiceSales/capitalClaim";
 
 import { h } from "vue";
 import { ElTag } from "element-plus";
@@ -124,8 +124,13 @@ const contentConfig: ContentConfig = {
   title: "资金认领管理",
   columns,
   isTree: true,
+  showDelete({ status } ={} ) {
+    console.log(status, 'prefix');
+    return status == '1'
+  },
   apis: {
-    httpList
+    httpList,
+    httpDelete
   }
 };
 

+ 1 - 0
src/views/interest/companyAccount/index.vue

@@ -225,6 +225,7 @@ onMounted(() => {
             size="small"
             :icon="useRenderIcon('add')"
             @click="editItem('', 'add', {})"
+            v-if="powers.some(i => i == '002')"
           >
             新增账号
           </el-button>

+ 1 - 3
src/views/purchase/orderRecord/detail.vue

@@ -63,9 +63,7 @@ async function onDownloadPayInfo() {
     onStart: () => (_loading.value = true),
     onSuccess: () => (_loading.value = false),
     onFail: () => (_loading.value = false),
-    params: {
-      payNo: id.value
-    }
+    params: { payNo: id.value }
   });
 }
 

+ 1 - 0
src/views/supplierManage/supplierAccoutManage/index.vue

@@ -230,6 +230,7 @@ onMounted(() => {
             size="small"
             :icon="useRenderIcon('add')"
             @click="editItem('', 'add', {})"
+            v-if="powers.some(i => i == '002')"
           >
             新增账号
           </el-button>

+ 5 - 0
src/views/supply/ticketReturnRelive/config/content.config.ts

@@ -25,6 +25,11 @@ const columns = [
     prop: "returnCode",
     width: 150
   },
+  {
+    label: "对账回票编码",
+    prop: "orderCode",
+    width: 150
+  },
   {
     label: "对账编码",
     prop: "payNo",

+ 39 - 14
src/views/supplyInvoiceSaleSettings/_component/finance-setting.vue

@@ -8,6 +8,8 @@ import { useRoute, useRouter } from "vue-router";
 import { useResponseHandle } from "/@/hooks";
 import { ElForm } from "element-plus";
 
+import QueryCategory from "./query-category.vue"
+
 const remoteSelectRef = ref<any>(null);
 
 
@@ -109,21 +111,23 @@ function handleRelatedCategories() {
   });
 }
 
-function handleSelectCategory(category) {
+function handleSelectCategory(category, isInit) {
   if (!category) {
     formData.tax = "";
     formData.cat_name = "";
     return (taxs.value = []);
   }
 
-  const { tax, cat_name } = category;
-  formData.cat_name = cat_name;
+  const { tax, label } = category;
+  formData.cat_name = label;
   taxs.value = [...tax, "0%"];
 
-  formData.tax = "";
-  formData.addTax = "";
-  formData.inv_tag = "";
-  formData.is_discount = "";
+  if(!isInit){
+    formData.tax = "";
+    formData.addTax = "";
+    formData.inv_tag = "";
+    formData.is_discount = "";
+  }
 }
 
 //优惠政策改变清空增值税管理和汇率标识
@@ -153,17 +157,20 @@ watch(
 );
 
 watch(
-  () => [props.detail,remoteSelectRef.value],
+  () => [props.detail, remoteSelectRef.value],
   async () => {
     if (!props.detail || !remoteSelectRef.value) return;
     const {
       cgd_inv_good_name,
       cgd_inv_cat_code,
+      inv_cat_code,
       is_discount,
       good_name,
       cgd_inv_tax,
+      inv_tax,
       inv_tag,
-      addTax
+      addTax,
+      status
     } = props.detail;
 
     formData.inv_good_name = cgd_inv_good_name ? cgd_inv_good_name : good_name;
@@ -179,13 +186,24 @@ watch(
       formData.addTax = addTax;
     });
 
-
-    if (cgd_inv_cat_code && remoteSelectRef.value) {
+    if (Number(status) === 1 && cgd_inv_cat_code && remoteSelectRef.value) {
       const params = { cat_code: cgd_inv_cat_code };
       const result = await remoteSelectRef.value.initalData(params);
       if (!result || !Array.isArray(result)) return;
       const { tax } = result[0];
-      taxs.value = tax;
+      taxs.value = [...tax, '0%','1%','3%'];
+    }
+
+    if (Number(status) === 2 && remoteSelectRef.value) {
+      const params = { cat_code: inv_cat_code };
+      const result = await remoteSelectRef.value.initalData(params);
+      if (!result || !Array.isArray(result)) return;
+      const { tax } = result[0];
+      taxs.value = [...tax, '0%','1%','3%'];
+      formData.tax = inv_tax;
+      formData.is_discount = String(is_discount);
+      formData.inv_tag = String(inv_tag) !== "0" ? String(inv_tag) : "";
+      formData.addTax = addTax;
     }
   },
   {
@@ -203,7 +221,7 @@ watch(
   >
     <div flex gap="1">
       <el-form-item label="商品类目设置" prop="cat_code" flex-1>
-        <RemoteSelect
+        <!-- <RemoteSelect
           ref="remoteSelectRef"
           w-full
           is-root
@@ -216,7 +234,14 @@ watch(
           sub-label-prop="short_name"
           @item-change="handleSelectCategory"
           @inital="code => (formData.cat_code = code)"
-        />
+        /> -->
+
+        <QueryCategory 
+            ref="remoteSelectRef"
+            v-model="formData.cat_code"
+            @change="handleSelectCategory"
+            classWrapper="finance-item"
+          />
       </el-form-item>
       <el-form-item label="开票商品名称" prop="inv_good_name" flex-1>
         <el-input

+ 40 - 17
src/views/supplyInvoiceSaleSettings/_component/procure-setting.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { computed, reactive, ref, watch, shallowRef } from "vue";
+import { computed, reactive, ref, watch, shallowRef, nextTick  } from "vue";
 import { cost_rules } from "./../supplyCommodityCost/config/configs";
 import RemoteSelect from "/@/components/RemoteSelect";
 import { useResponseHandle } from "/@/hooks";
@@ -7,6 +7,8 @@ import { useRoute } from "vue-router";
 import { ElForm } from "element-plus";
 import { httpCatlist, httpAdd } from "/@/api/InvoiceSaleSettings/commodityCost";
 
+import QueryCategory from "./query-category.vue"
+
 import { type DescriptionColumn } from "/@/components/BasicDescriptions";
 
 const remoteSelectRef = ref<any>(null);
@@ -68,40 +70,55 @@ function handleRelatedCategories() {
   });
 }
 
-function handleSelectCategory(category) {
+function handleSelectCategory(category, isInit) {
   if (!category) {
     formData.tax = "";
     formData.cat_name = "";
     return (taxs.value = []);
   }
 
-  const { tax, cat_name } = category;
+  const { tax, label } = category;
   taxs.value = [...tax, "0%"];
-  formData.cat_name = cat_name;
-  formData.tax = "";
+
+  if(!isInit){
+    formData.cat_name = label;
+    formData.tax = "";
+  }
 }
 
 watch(
   () => props.detail,
   async () => {
-    console.log(props.detail);
-    if (!props.detail) return;
-    const { inv_good_name, inv_cat_code, good_name, inv_tax } = props.detail;
+      if (!props.detail) return;
+    const { inv_good_name, inv_cat_code, good_name, inv_tax, cgd_inv_tax, cgd_inv_cat_code } = props.detail;
 
     formData.inv_good_name = inv_good_name ? inv_good_name : good_name;
     formData.tax = inv_tax ? inv_tax * 100 + "%" : "";
 
+
     if (formData.inv_good_name.length > 70) {
       formData.inv_good_name = formData.inv_good_name.slice(0, 70);
     }
 
-    if (inv_cat_code && remoteSelectRef.value) {
-      const params = { cat_code: inv_cat_code };
-      const result = await remoteSelectRef.value.initalData(params);
-      if (!result || !Array.isArray(result)) return;
-      const { tax } = result[0];
-      taxs.value = tax;
-    }
+    if (cgd_inv_tax) {
+        formData.tax = cgd_inv_tax;
+      }
+
+    nextTick(async () => {
+      if (inv_cat_code && remoteSelectRef.value && inv_cat_code.trim().length !== 0) {
+        const params = { cat_code: inv_cat_code };
+        const result = await remoteSelectRef.value.initalData(params);
+        if (!result || !Array.isArray(result)) return;
+        const { tax } = result[0];
+        taxs.value = [...tax, '0%','1%','3%'];
+      } else if (cgd_inv_cat_code && remoteSelectRef.value && cgd_inv_cat_code.trim().length !== 0) {
+        const params = { cat_code: cgd_inv_cat_code };
+        const result = await remoteSelectRef.value.initalData(params);
+        if (!result || !Array.isArray(result)) return;
+        const { tax } = result[0];
+        taxs.value = [...tax, '0%','1%','3%'];
+      }
+    })
   },
   {
     immediate: true
@@ -118,7 +135,7 @@ watch(
   >
     <div flex gap="1">
       <el-form-item label="商品类目设置" prop="cat_code" flex-1>
-        <RemoteSelect
+        <!-- <RemoteSelect
           ref="remoteSelectRef"
           w-full
           is-root
@@ -131,7 +148,13 @@ watch(
           sub-label-prop="short_name"
           @item-change="handleSelectCategory"
           @inital="code => (formData.cat_code = code)"
-        />
+        /> -->
+
+        <QueryCategory 
+            ref="remoteSelectRef"
+            v-model="formData.cat_code"
+            @change="handleSelectCategory"
+          />
       </el-form-item>
       <el-form-item label="开票商品名称" prop="inv_good_name" flex-1>
         <el-input

+ 258 - 0
src/views/supplyInvoiceSaleSettings/_component/query-category.vue

@@ -0,0 +1,258 @@
+<script setup lang="ts">
+import { useDebounceFn } from "@vueuse/core";
+import { ref, onMounted, reactive, onUnmounted, watch } from "vue";
+import { getCategories } from "/@/api/user";
+import { useResponseHandle } from "/@/hooks/core/useAsync";
+import { useCompany } from "/@/hooks/core/useCompany";
+import { useUserInfo } from "/@/hooks/core/useUser";
+
+import { useVModel } from "@vueuse/core"
+
+const emit = defineEmits(["change", "update:modelValue"]);
+
+
+const props = withDefaults(
+  defineProps<{
+    noAll?: boolean;
+    noSet?: boolean;
+    modelValue?: string;
+    isSupplier?: boolean;
+    placeholder?: string;
+    classWrapper?:string
+  }>(),
+  {
+    modelValue: "",
+    classWrapper: 'procure-item'
+  }
+);
+
+const value = useVModel(props, 'modelValue')
+
+
+const { setCurrentCompany } = useCompany();
+const responseHandle = useResponseHandle();
+
+const { userLevel } = useUserInfo();
+
+const selectRef = ref(null);
+const list = ref<any[]>([]);
+
+const state = reactive({
+  loading: false,
+  noMore: false,
+  name: "",
+  count: 0,
+  page: 1
+});
+
+let scrollWrapper: HTMLDivElement | null = null;
+
+const debouceScroll = useDebounceFn(handleScroll, 500);
+
+async function requesetSupplierAll(name: string) {
+  state.name = name;
+  state.page = 1;
+  state.noMore = false;
+  const api = getCategories
+  const { data, message, code } = await api({
+    cat_name: name,
+    size:10,
+    page: state.page
+  });
+
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      list.value = data.list.map(({ short_name, cat_name, merge_code,tax }) => ({
+        tax,
+        subTitle: short_name,
+        value: merge_code,
+        label: cat_name
+      }))
+
+      state.count = data.count;
+      state.loading = false;
+      const maxPage = Math.ceil(state.count / 10);
+      state.noMore = maxPage <= 1;
+    }
+  });
+}
+
+function handleChange(v) {
+  const item = list.value.find(({ value }) => v === value);
+  console.log(list.value, value, item)
+  emit("change", item);
+}
+
+async function handleScroll() {
+  const height = scrollWrapper?.clientHeight;
+  const scrollTop = scrollWrapper?.scrollTop;
+  const scrollHeight = scrollWrapper?.scrollHeight;
+
+  if (height + scrollTop >= scrollHeight && !state.noMore) {
+    state.page++;
+    state.loading = true;
+
+    const api = getCategories
+
+
+    const { data, message, code } = await api({
+      cat_name: state.name,
+      page: state.page,
+      size:10,
+      noRela: true
+    });
+
+    const pushCompany = (_list: any[]) => {
+      list.value = [...list.value, ..._list.map(({ short_name, cat_name, merge_code, tax }) => ({
+        tax,
+        subTitle: short_name,
+        value: merge_code,
+        label: cat_name
+      }))];
+    };
+
+    responseHandle({
+      code,
+      message,
+      handler: () => {
+        state.count = data.count;
+        const maxPage = Math.ceil(state.count / 10);
+
+        if (state.page > maxPage) {
+          state.noMore = true;
+          state.loading = false;
+          return;
+        }
+
+        pushCompany(data.list);
+      }
+    });
+  }
+}
+
+onMounted(() => {
+  setTimeout(() => {
+    const superItem = document.querySelector("." + props.classWrapper);
+    if (!superItem) return;
+    scrollWrapper = superItem.parentElement?.parentElement as HTMLDivElement;
+    if (scrollWrapper) {
+      scrollWrapper.addEventListener("scroll", debouceScroll, false);
+    }
+  }, 1000);
+});
+
+onUnmounted(() => {
+  state.loading = false;
+  state.noMore = false;
+  state.name = "";
+  state.page = 1;
+
+  if (scrollWrapper) {
+    scrollWrapper.removeEventListener("scroll", debouceScroll);
+  }
+});
+
+watch(
+  () => userLevel.value,
+  level => {
+    if (level !== "") {
+      state.loading = false;
+      state.noMore = false;
+      state.name = "";
+      state.page = 1;
+      list.value = [];
+      requesetSupplierAll(undefined);
+    }
+  }
+);
+
+const getLabel = company => {
+  const { value, label } = company;
+  return value + " / " + label;
+};
+
+
+
+const getLabel2 = company => {
+  const { value, label, subTitle } = company;
+  return value + " / " + label + '-' + subTitle;
+};
+
+
+requesetSupplierAll(undefined);
+
+
+defineExpose({
+  async initalData(params){
+    const { data, message, code } = await getCategories(params);
+
+    list.value = (data.list || []).map(({ tax, cat_name ,merge_code, short_name }) => ({
+      tax,
+      value: merge_code,
+      label: cat_name,
+      subTitle: short_name
+    }))
+
+    value.value = (list.value[0] || {}).value
+    emit('change', list.value[0], true)
+  }
+})
+
+</script>
+
+<template>
+  <ElSelect
+    filterable
+    remote
+    v-model="value"
+    :remote-method="requesetSupplierAll"
+    @change="handleChange"
+    style="width: 100%"
+    ref="selectRef"
+    placeholder="商品类目"
+  >
+    <ElOption
+      :class="classWrapper"
+      v-for="item in list"
+      :key="item.value"
+      :value="item.value"
+      :label="getLabel2(item)"
+    >
+      <span style="float: left">
+         {{getLabel(item)}}
+      </span>
+
+      <span style="float: right;color: var(--el-text-color-secondary);font-size: 13px;">
+        {{item.subTitle}}
+      </span>
+    </ElOption>
+
+    <p class="super-loading" v-if="state.loading">
+      <IconifyIconOffline class="animate-spin" icon="Loading" />
+      加载中
+    </p>
+
+    <p class="super-no-more" v-if="state.noMore">没有更多数据了...</p>
+  </ElSelect>
+</template>
+
+<style lang="scss" scoped>
+.super-no-more {
+  text-align: center;
+  color: #999;
+  font-size: 14px;
+  line-height: 38px;
+}
+
+.super-loading {
+  display: flex;
+  font-size: 14px;
+  justify-content: center;
+  align-items: center;
+  color: #999;
+  gap: 10px;
+  line-height: 38px;
+}
+</style>

+ 0 - 15
src/views/supplyInvoiceSaleSettings/basic-settings.vue

@@ -50,21 +50,6 @@ const actives = ref(["1", "2"]);
           @refresh="emit('refresh')"
         />
       </ElCollapseItem>
-
-      <ElCollapseItem
-        v-if="detail && ( detail.status === '1' ||detail.status === '2') && hasPermissionWithCode('044')"
-        title="待财务设置类目"
-        name="2"
-      >
-        <finance-setting
-          :name="name"
-          :detail="detail"
-          :columns="columns"
-          :back-route="backRoute"
-          :can-change="canChange"
-          @refresh="emit('refresh')"
-        />
-      </ElCollapseItem>
     </ElCollapse>
   </div>
 </template>

+ 1 - 0
types/global.d.ts

@@ -89,6 +89,7 @@ declare global {
     BACK_URL: string
     VITE_GD_URL?: string
     VITE_DASHBOARD_URL?: string
+    VITE_WORKORDER_REAL?:string
   }
 
   declare interface ServerConfigs {