Browse Source

feat:供应商经营分析报表

snow 1 year ago
parent
commit
455abb4137
35 changed files with 1100 additions and 64 deletions
  1. 1 1
      src/api/netOrderEnter/netOrderEntry/index.ts
  2. 1 1
      src/api/user.ts
  3. 8 0
      src/components/BasicForm/src/basic-form.vue
  4. 52 0
      src/components/BasicForm/src/fields/supplier-permisson/index.vue
  5. 58 0
      src/components/BasicForm/src/fields/supplier-permisson/normal-user.vue
  6. 94 0
      src/components/BasicForm/src/fields/supplier-permisson/super-admin.vue
  7. 2 1
      src/components/BasicForm/src/types.ts
  8. 2 4
      src/store/modules/user.ts
  9. 1 0
      src/views/subscribe/_hooks/index.ts
  10. 33 0
      src/views/subscribe/_hooks/useSupplierQuery.ts
  11. 9 3
      src/views/subscribe/businessAnalysis/components/config/apis.ts
  12. 9 3
      src/views/subscribe/frontSubscribe/components/config/apis.ts
  13. 9 3
      src/views/subscribe/fundClaim/components/config/apis.ts
  14. 9 3
      src/views/subscribe/incomeInvoice/components/config/apis.ts
  15. 9 3
      src/views/subscribe/paymentDetails/components/config/apis.ts
  16. 9 3
      src/views/subscribe/procureDetail/components/config/apis.ts
  17. 9 3
      src/views/subscribe/receivableLedger/components/config/apis.ts
  18. 12 3
      src/views/subscribe/reconciliationProcurement/components/config/apis.ts
  19. 12 3
      src/views/subscribe/reconciliationSummary/components/config/apis.ts
  20. 9 3
      src/views/subscribe/returnTicket/components/config/apis.ts
  21. 9 3
      src/views/subscribe/revenueCost/components/config/apis.ts
  22. 9 3
      src/views/subscribe/saleInvoice/components/config/apis.ts
  23. 9 3
      src/views/subscribe/salesReturnSubscribe/components/config/apis.ts
  24. 99 0
      src/views/subscribe/supplierBusinessAnalysis/components/all.vue
  25. 102 0
      src/views/subscribe/supplierBusinessAnalysis/components/business.vue
  26. 19 0
      src/views/subscribe/supplierBusinessAnalysis/components/config/apis.ts
  27. 94 0
      src/views/subscribe/supplierBusinessAnalysis/components/config/content.company.config.ts
  28. 97 0
      src/views/subscribe/supplierBusinessAnalysis/components/config/content.config.ts
  29. 20 0
      src/views/subscribe/supplierBusinessAnalysis/components/config/search.config.ts
  30. 191 0
      src/views/subscribe/supplierBusinessAnalysis/components/demand-modify-modal.vue
  31. 41 0
      src/views/subscribe/supplierBusinessAnalysis/components/exec-modal.vue
  32. 48 0
      src/views/subscribe/supplierBusinessAnalysis/index.vue
  33. 0 0
      src/views/subscribe/supplierBusinessAnalysis/供应商经营分析报表
  34. 9 3
      src/views/subscribe/yongyou/components/config/apis.ts
  35. 5 15
      src/views/system/accountRole/index.vue

+ 1 - 1
src/api/netOrderEnter/netOrderEntry/index.ts

@@ -44,7 +44,7 @@ export const httpCompanylist = (data): any => {
 };
 
 export const httpSupplierlist = (data): any => {
-  return http.request("post", `${yewuApi}supplier_by_super`, { data });
+  return http.request("post", `${yewuApi}supplierlist`, { data });
 };
 
 export const httpCategorylist = (data): any => {

+ 1 - 1
src/api/user.ts

@@ -64,7 +64,7 @@ export const httpSupplierall = (data: object): any => {
 };
 
 export const httpSupplierList = (data: object): any => {
-  return http.request("post", `${yewuApi}supplier_by_super`, {
+  return http.request("post", `${accountApi}depart/supplier `, {
     data
   });
 };

+ 8 - 0
src/components/BasicForm/src/basic-form.vue

@@ -9,6 +9,7 @@ import { ImageSingleUpload } from "/@/components/ImageUpload";
 import SupplierQuery from "./fields/supplier-query.vue";
 import BusinessQuery from "./fields/business-query.vue";
 import BusinessPermission from "./fields/business-permission/index.vue";
+import SupplierPermission from "./fields/supplier-permisson/index.vue";
 import DepartQuery from "./fields/depart.vue";
 import User from "./fields/user.vue"
 
@@ -113,6 +114,13 @@ defineExpose({ vaildate });
               />
             </template>
 
+           <template v-if="item.type === 'supplier-permission'">
+              <SupplierPermission
+                @change="handleChange(item)"
+                v-model="formData[item.field]"
+              />
+            </template>
+
             <!-- 选择框 -->
             <template v-if="item.type === 'select'">
               <el-select

+ 52 - 0
src/components/BasicForm/src/fields/supplier-permisson/index.vue

@@ -0,0 +1,52 @@
+<script setup lang="ts">
+import { nextTick, ref, watch } from "vue";
+import { useUserInfo } from "/@/hooks/core/useUser";
+import NormalUser from "./normal-user.vue";
+import SuperAdmin from "./super-admin.vue";
+
+const props = defineProps<{
+  notInitial?: Boolean
+  disabled?: Boolean;
+}>()
+
+const SuperAdminRef = ref<InstanceType<typeof SuperAdmin> | null>(null);
+const NormalUserRef = ref<InstanceType<typeof NormalUser> | null>(null);
+
+const { isSuperUser } = useUserInfo();
+const emit = defineEmits(["change", "update:modelValue"]);
+
+function handleChange(value) {
+  emit("update:modelValue", value);
+  nextTick(() => emit("change", value));
+}
+
+watch(
+  () => isSuperUser.value,
+  () => {
+    nextTick(() => {
+      if (props.notInitial) return
+      isSuperUser.value ? SuperAdminRef.value?.intialData() : NormalUserRef.value?.intialData();
+    });
+  },
+  {
+    immediate: true
+  }
+);
+
+defineExpose({
+  initialData(value: string) {
+    isSuperUser.value ? SuperAdminRef.value?.intialData(value) : NormalUserRef.value?.intialData(value);
+   }
+})
+</script>
+
+<template>
+  <div class="business-permission" style="width: 100%">
+    <template v-if="isSuperUser">
+      <super-admin :disabled="disabled" @change="handleChange" ref="SuperAdminRef" />
+    </template>
+    <template v-else>
+      <normal-user :disabled="disabled" @change="handleChange" ref="NormalUserRef" />
+    </template>
+  </div>
+</template>

+ 58 - 0
src/components/BasicForm/src/fields/supplier-permisson/normal-user.vue

@@ -0,0 +1,58 @@
+<script setup lang="ts">
+import { ref, shallowRef, computed } from "vue";
+import { httpCompany } from "/@/api/user";
+import { useResponseHandle } from "/@/hooks/core/useAsync";
+import { useUserStore } from "/@/store/modules/user";
+
+const emit = defineEmits(["change"]);
+const actived = shallowRef("");
+
+// const list = ref<any[]>([]);
+const responseHandle = useResponseHandle();
+
+const userStore = useUserStore();
+
+const list = computed(() => userStore.business);
+
+async function requestCompanies(isIntial: boolean,value:string) {
+  const [first] = userStore.business || [];
+  const { companyCode } = first || {};
+
+  if (value) {
+    actived.value = value;
+    handleChange(value);
+  }else if (isIntial) {
+    actived.value = companyCode;
+    handleChange(companyCode);
+  }
+}
+
+async function intialData(value: string) {
+  requestCompanies(true, value);
+}
+
+async function handleChange(value) {
+  emit("change", value);
+}
+
+defineExpose({
+  intialData
+});
+</script>
+
+<template>
+  <ElSelect
+    filterable
+    v-model="actived"
+    :remote-method="requestCompanies"
+    style="width: 100%"
+    @change="handleChange"
+  >
+    <ElOption
+      v-for="opt in list"
+      :key="opt.companyCode"
+      :value="opt.companyCode"
+      :label="opt.companyName"
+    />
+  </ElSelect>
+</template>

+ 94 - 0
src/components/BasicForm/src/fields/supplier-permisson/super-admin.vue

@@ -0,0 +1,94 @@
+<script setup lang="ts">
+import { ref, shallowRef, watch } from "vue";
+import {httpSupplierList } from "/@/api/user";
+import { useResponseHandle } from "/@/hooks/core/useAsync";
+import { useUserInfo } from "/@/hooks/core/useUser";
+
+const emit = defineEmits(["change", "update:value"]);
+
+const props = defineProps<{
+  value?: string;
+  placeholder?: string;
+  isSupplier?: boolean;
+  disabled: Boolean;
+}>();
+
+const responseHandle = useResponseHandle();
+
+const { userLevel } = useUserInfo();
+
+const value = shallowRef("");
+const list = ref<Record<string, string>[]>([]);
+
+
+async function requesetCompanies(
+  name: string,
+  _companyNo: string,
+  isIntial?: boolean
+) {
+  console.log(_companyNo);
+
+  const api = httpSupplierList;
+
+  const { data, message, code } = await api({
+    name,
+    size: 100
+  });
+
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      list.value = data.list;
+
+      if (isIntial && !_companyNo) {
+        const { code } = list.value[0] || {};
+        value.value = code;
+        handleChange(code);
+      } else { 
+        value.value = _companyNo
+        handleChange(_companyNo);
+      }
+    }
+  });
+}
+
+const handleChange = value => emit("change", value);
+
+watch(
+  () => userLevel.value,
+  level => {
+    if (level !== "") {
+      list.value = [];
+      requesetCompanies(undefined, props.value);
+    }
+  }
+);
+
+async function intialData(value: string) {
+  requesetCompanies(undefined, value, true);
+}
+
+defineExpose({
+  selectAll: () => (value.value = ""),
+  intialData
+});
+</script>
+
+<template>
+  <ElSelect
+    filterable
+    :disabled="disabled"
+    v-model="value"
+    @change="handleChange"
+    style="width: 100%"
+    :placeholder="placeholder"
+  >
+    <ElOption
+      v-for="opt in list"
+      :key="opt.code"
+      :value="opt.code"
+      :label="opt.name"
+    />
+  </ElSelect>
+</template>

+ 2 - 1
src/components/BasicForm/src/types.ts

@@ -19,7 +19,8 @@ export type FormItemType =
   | "business-query"
   | "business-permission"
   | "depart-query"
-  | "user-query";
+  | "user-query"
+  | "supplier-permission";
 
 export type FormItem = {
   field: string;

+ 2 - 4
src/store/modules/user.ts

@@ -70,7 +70,7 @@ export const useUserStore = defineStore({
       this.actions = value;
     },
     SET_CURRENT_COMPANY(currentCompany) {
-      this.currentCompany = currentCompany;
+      this.currentComapny = currentCompany;
     },
     // 登入
     async loginByUsername(form) {
@@ -133,9 +133,7 @@ export const useUserStore = defineStore({
         }
 
         if (this.level === "3") {
-          throw new Error(
-            JSON.stringify({ code: 10000, message: "供应商端账号无法登录" })
-          );
+          this.business = data.company_relaton;
         }
 
         return data;

+ 1 - 0
src/views/subscribe/_hooks/index.ts

@@ -1,2 +1,3 @@
 export { useBusinessContent } from "./useBusinessContent";
 export { useBusinessSearch } from "./useBusinessQuery";
+export { useSupplierQuery } from "./useSupplierQuery"

+ 33 - 0
src/views/subscribe/_hooks/useSupplierQuery.ts

@@ -0,0 +1,33 @@
+import { computed, shallowRef } from "vue";
+import { FormConfig } from "/@/components/PageSearch";
+
+interface IQueryOptions {
+  sourceConfig: FormConfig;
+  queryField?: string;
+}
+
+export function useSupplierQuery(options: IQueryOptions) {
+  const { sourceConfig, queryField = "relaComNo" } = options;
+  const searchConfig = JSON.parse(JSON.stringify(sourceConfig));
+
+  const companyNo = shallowRef("");
+  const isHasCompany = computed(() => companyNo.value === "");
+
+  searchConfig.formItems = [
+    ...searchConfig.formItems,
+    {
+      noRest: true,
+      trigger: "change",
+      field: queryField,
+      placeholder: "供应商",
+      type: "supplier-permission",
+      onChange: (value: string) => (companyNo.value = value)
+    }
+  ];
+
+  return {
+    searchConfig,
+    isHasCompany,
+    companyNo
+  };
+}

+ 9 - 3
src/views/subscribe/businessAnalysis/components/config/apis.ts

@@ -3,8 +3,14 @@ import { createHttpRequest } from "/@/views/time/_http";
 const baseUrl = "admin/exec/";
 
 export default {
-  list: createHttpRequest(`${baseUrl}listLog`, { defaultData: { exec_id: 9 }, url: "" }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
+  list: createHttpRequest(`${baseUrl}listLog`, { defaultData: { exec_id: 9, type: 1 }, url: "" }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/frontSubscribe/components/config/apis.ts

@@ -5,10 +5,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 1 },
+    defaultData: { exec_id: 1, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`),
 };

+ 9 - 3
src/views/subscribe/fundClaim/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 6 },
+    defaultData: { exec_id: 6, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/incomeInvoice/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 5 },
+    defaultData: { exec_id: 5, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/paymentDetails/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 7 },
+    defaultData: { exec_id: 7, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/procureDetail/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 3 },
+    defaultData: { exec_id: 3, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/receivableLedger/components/config/apis.ts

@@ -3,8 +3,14 @@ import { createHttpRequest } from "/@/views/time/_http";
 const baseUrl = "admin/exec/";
 
 export default {
-  list: createHttpRequest(`${baseUrl}listLog`, { defaultData: { exec_id: 11 }, url: "" }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
+  list: createHttpRequest(`${baseUrl}listLog`, { defaultData: { exec_id: 11, type: 1 }, url: "" }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 12 - 3
src/views/subscribe/reconciliationProcurement/components/config/apis.ts

@@ -3,8 +3,17 @@ import { createHttpRequest } from "/@/views/time/_http";
 const baseUrl = "admin/exec/";
 
 export default {
-  list: createHttpRequest(`${baseUrl}listLog`, { defaultData: { exec_id: 14 }, url: "" }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
+  list: createHttpRequest(`${baseUrl}listLog`, {
+    defaultData: { exec_id: 14, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 12 - 3
src/views/subscribe/reconciliationSummary/components/config/apis.ts

@@ -3,8 +3,17 @@ import { createHttpRequest } from "/@/views/time/_http";
 const baseUrl = "admin/exec/";
 
 export default {
-  list: createHttpRequest(`${baseUrl}listLog`, { defaultData: { exec_id: 13 }, url: "" }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
+  list: createHttpRequest(`${baseUrl}listLog`, {
+    defaultData: { exec_id: 13, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/returnTicket/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 8 },
+    defaultData: { exec_id: 8, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/revenueCost/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 10 },
+    defaultData: { exec_id: 10, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/saleInvoice/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 4 },
+    defaultData: { exec_id: 4, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 9 - 3
src/views/subscribe/salesReturnSubscribe/components/config/apis.ts

@@ -5,10 +5,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 2 },
+    defaultData: { exec_id: 2, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 99 - 0
src/views/subscribe/supplierBusinessAnalysis/components/all.vue

@@ -0,0 +1,99 @@
+<script setup lang="ts">
+import { ref, watch } from "vue";
+import searchConfig from "./config/search.config";
+import contentConfig from "./config/content.config";
+
+import { PageContentInstance } from "/@/components/PageContent";
+import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
+import { usePageSearch, type PageHooks } from "/@/hooks/page";
+import { usePermission } from "/@/hooks/core";
+
+import DemandModifyModal from "./demand-modify-modal.vue";
+import ExecModal from "./exec-modal.vue";
+import { ElMessage } from "element-plus";
+import apis from "./config/apis";
+
+const pageName = "supplierBusinessAnalysis";
+
+const demandModifyModal = ref<InstanceType<typeof DemandModifyModal> | null>(null);
+const execModalRef = ref<InstanceType<typeof ExecModal> | null>(null);
+const pageContentRef = ref<PageContentInstance | null>(null);
+const { hasPermissionWithCode } = usePermission(pageName);
+
+
+async function deleteItem(id: string) {
+  const response = await apis.delete_exec({ id });
+  if (response.code === 1) {
+    pageContentRef.value.onSearch();
+  } else {
+    ElMessage.warning(response.message);
+  }
+}
+
+const hooks: PageHooks = {
+  pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
+};
+</script>
+
+<template>
+  <page-auth :page-name="pageName">
+    <page-container
+      :hooks="hooks"
+      :page-name="pageName"
+      :search-config="searchConfig"
+      :get-content-ref="ref => (pageContentRef = ref)"
+      :content-config="contentConfig"
+    >
+      <template #content_header>
+        <el-button type="" size="mini" @click="execModalRef?.onDisplay({})">
+          查看执行类型说明
+        </el-button>
+        
+        <el-button
+          size="mini"
+          type="primary"
+          @click="demandModifyModal?.onDisplay({})"
+        >
+          添加
+        </el-button>
+      </template>
+
+      <template #content_action="row">
+        <el-link
+          :href="row.down_url"
+          v-if="String(row.status) === '2' && hasPermissionWithCode('10')"
+          target="_blank"
+          :underline="false"
+        >
+          <ElButton
+            link
+            size="small"
+            type="primary"
+            :icon="useRenderIcon('download-line')"
+          />
+        </el-link>
+
+        <el-popconfirm
+          title="是否确认删除该条记录?"
+          @confirm="deleteItem(row.id)"
+          v-if="hasPermissionWithCode('8') && String(row.status) === '3'"
+        >
+          <template #reference>
+            <ElButton
+              link
+              size="small"
+              type="primary"
+              :icon="useRenderIcon('delete')"
+            />
+          </template>
+        </el-popconfirm>
+      </template>
+    </page-container>
+    <demand-modify-modal
+      ref="demandModifyModal"
+      @refresh="pageContentRef.onSearch()"
+    />
+
+    <ExecModal ref="execModalRef" />
+  </page-auth>
+</template>

+ 102 - 0
src/views/subscribe/supplierBusinessAnalysis/components/business.vue

@@ -0,0 +1,102 @@
+<script setup lang="ts">
+import { ref } from "vue";
+import sourceSearchConfig from "./config/search.config";
+import contentConfig from "./config/content.company.config";
+
+import { PageContentInstance } from "/@/components/PageContent";
+import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
+import { usePageSearch, type PageHooks } from "/@/hooks/page";
+
+import DemandModifyModal from "./demand-modify-modal.vue";
+import { useSupplierQuery } from "../../_hooks";
+import { usePermission } from "/@/hooks/core";
+import ExecModal from "./exec-modal.vue";
+import { ElMessage } from "element-plus";
+import apis from "./config/apis";
+
+const pageName = "supplierBusinessAnalysis";
+
+const { searchConfig } = useSupplierQuery({
+  sourceConfig: sourceSearchConfig,
+  queryField: "companyNo"
+});
+
+const { hasPermissionWithCode } = usePermission(pageName);
+const pageContentRef = ref<PageContentInstance | null>(null);
+const execModalRef = ref<InstanceType<typeof ExecModal> | null>(null);
+const demandModifyModal = ref<InstanceType<typeof DemandModifyModal> | null>( null );
+
+const hooks: PageHooks = {
+  pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
+};
+
+async function deleteItem(id: string) {
+  const response = await apis.delete_exec({ id });
+  if (response.code === 1) {
+    pageContentRef.value.onSearch();
+  } else {
+    ElMessage.warning(response.message);
+  }
+}
+
+function handleCreate() {
+  const { companyNo } = pageContentRef.value.getBasicParams();
+  demandModifyModal.value?.onDisplay(companyNo);
+}
+</script>
+
+<template>
+  <page-auth :page-name="pageName" :all="false">
+    <page-container
+      :search-config="searchConfig"
+      :hooks="hooks"
+      :page-name="pageName"
+      :get-content-ref="ref => (pageContentRef = ref)"
+      :content-config="contentConfig"
+      lockKey="companyNo"
+    >
+      <template #content_header>
+        <el-button type="" size="mini" @click="execModalRef?.onDisplay({})"
+          >查看执行类型说明</el-button
+        >
+        <el-button type="primary" size="mini" @click="handleCreate"
+          >添加</el-button
+        >
+      </template>
+
+      <template #content_action="row">
+        <el-link
+          :href="row.down_url"
+          v-if="String(row.status) === '2' && hasPermissionWithCode('19')"
+          target="_blank"
+          :underline="false"
+        >
+          <ElButton
+            link
+            size="small"
+            type="primary"
+            :icon="useRenderIcon('download-line')"
+          />
+        </el-link>
+        <el-popconfirm
+          title="是否确认删除该条记录?"
+          @confirm="deleteItem(row.id)"
+          v-if="hasPermissionWithCode('17') && String(row.status) === '3'"
+        >
+          <template #reference>
+            <ElButton
+              link
+              size="small"
+              type="primary"
+              :icon="useRenderIcon('delete')"
+            />
+          </template>
+        </el-popconfirm>
+      </template>
+    </page-container>
+
+    <DemandModifyModal ref="demandModifyModal" :is-business="true" @refresh="pageContentRef.onSearch()" />
+    <ExecModal ref="execModalRef" />
+
+  </page-auth>
+</template>

+ 19 - 0
src/views/subscribe/supplierBusinessAnalysis/components/config/apis.ts

@@ -0,0 +1,19 @@
+import { createHttpRequest } from "/@/views/time/_http";
+
+const baseUrl = "admin/exec/";
+
+export default {
+  list: createHttpRequest(`${baseUrl}listLog`, {
+    defaultData: { exec_id: 15, type: 2 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 2 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 2 },
+    url: ""
+  }),
+  delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
+};

+ 94 - 0
src/views/subscribe/supplierBusinessAnalysis/components/config/content.company.config.ts

@@ -0,0 +1,94 @@
+/* eslint-disable prettier/prettier */
+import { BeforeRequestType, ContentConfig } from "/@/components/PageContent";
+import apis from "./apis";
+import { h } from "vue";
+import { ElTag } from "element-plus";
+
+const statusOptions = [
+  { value: 1, label: '待执行', type: "info" },
+  { value: 2, label: '执行完成', type: "success" },
+  { value: 3, label: '执行失败', type: 'danger' },
+]
+
+const exceTypeOptions = [
+  { value: 1, label: '立即执行', type: "" },
+  { value: 2, label: '延迟执行', type: "warning" },
+]
+
+const columns = [
+  {
+    prop: "exec_name",
+    label: "业务表名称",
+    minWidth: "115px"
+  },
+  {
+    prop: "start",
+    label: "数据开始时间",
+    minWidth: "155px"
+  },
+  {
+    prop: "end",
+    label: "数据结束时间",
+    minWidth: "155px"
+  },
+  {
+    prop: "updatetime",
+    label: "状态更新时间",
+    minWidth: "155px"
+  },
+
+  {
+    prop: "createtime",
+    label: "创建时间",
+    minWidth: "115px"
+  },
+  {
+    prop: 'exce_type',
+    label: '执行类型',
+    cellRenderer({ row }) {
+      const s = exceTypeOptions.find(({ value }) => String(value) === String(row.exec_type))
+      return h(ElTag, {
+        type: s.type || ''
+      }, {
+        default: () => s.label || '--'
+      })
+    }
+  },
+  {
+    prop: 'status',
+    label: '状态',
+    cellRenderer({ row }) {
+      const s = statusOptions.find(({ value }) => String(value) === String(row.status))
+      return h(ElTag, {
+        type: s.type || ''
+      }, {
+        default: () => s.label || '--'
+      })
+    }
+  },
+  {
+    prop: "companyName",
+    label: "供应商名称",
+    minWidth: "155px"
+  },
+  {
+    prop: "apply_name",
+    label: "申请人",
+    minWidth: "80px"
+  },
+  {
+    label: "操作",
+    fixed: "right",
+    width: 90,
+    slot: "operation"
+  }
+];
+
+const contentConfig: ContentConfig = {
+  columns,
+  showTitle: false,
+  superUserNoAction: false,
+  apis: { httpList: apis.list }
+};
+
+export default contentConfig;

+ 97 - 0
src/views/subscribe/supplierBusinessAnalysis/components/config/content.config.ts

@@ -0,0 +1,97 @@
+/* eslint-disable prettier/prettier */
+import { BeforeRequestType, ContentConfig } from "/@/components/PageContent";
+import apis from "./apis";
+import { h } from "vue";
+import { ElTag } from "element-plus";
+
+const statusOptions = [
+  { value: 1, label: '待执行', type: "info" },
+  { value: 2, label: '执行完成', type: "success" },
+  { value: 3, label: '执行失败', type: 'danger' },
+]
+
+const exceTypeOptions = [
+  { value: 1, label: '立即执行', type: "" },
+  { value: 2, label: '延迟执行', type: "warning" },
+]
+
+const columns = [
+  {
+    prop: "exec_name",
+    label: "业务表名称",
+    minWidth: "115px"
+  },
+
+  {
+    prop: "start",
+    label: "数据开始时间",
+    minWidth: "155px"
+  },
+
+  {
+    prop: "end",
+    label: "数据结束时间",
+    minWidth: "155px"
+  },
+
+  {
+    prop: "updatetime",
+    label: "状态更新时间",
+    minWidth: "155px"
+  },
+
+  {
+    prop: "createtime",
+    label: "创建时间",
+    minWidth: "115px"
+  },
+  {
+    prop: 'exce_type',
+    label: '执行类型',
+    cellRenderer({ row }) {
+      const s = exceTypeOptions.find(({ value }) => String(value) === String(row.exec_type))
+      return h(ElTag, {
+        type: s.type || ''
+      }, {
+        default: () => s.label || '--'
+      })
+    }
+  },
+  {
+    prop: 'status',
+    label: '状态',
+    cellRenderer({ row }) {
+      const s = statusOptions.find(({ value }) => String(value) === String(row.status))
+      return h(ElTag, {
+        type: s.type || ''
+      }, {
+        default: () => s.label || '--'
+      })
+    }
+  },
+  // {
+  //   prop: "departName",
+  //   label: "部门名称",
+  //   minWidth: "155px"
+  // },
+  {
+    prop: "apply_name",
+    label: "申请人",
+    minWidth: "80px"
+  },
+  {
+    label: "操作",
+    fixed: "right",
+    width: 90,
+    slot: "operation"
+  }
+];
+
+const contentConfig: ContentConfig = {
+  columns,
+  showTitle: false,
+  superUserNoAction: false,
+  apis: { httpList: apis.list }
+};
+
+export default contentConfig;

+ 20 - 0
src/views/subscribe/supplierBusinessAnalysis/components/config/search.config.ts

@@ -0,0 +1,20 @@
+import { FormConfig } from "/@/components/PageSearch";
+import { useUserStore } from "/@/store/modules/user";
+
+const searchFormConfig: FormConfig = {
+  formItems: [
+    {
+      field: "status",
+      type: "select",
+      placeholder: "状态",
+      trigger: "change",
+      options: [
+        { value: 1, label: "待执行", type: "info" },
+        { value: 2, label: "执行完成", type: "success" },
+        { value: 3, label: "执行失败", type: "danger" }
+      ]
+    }
+  ]
+};
+
+export default searchFormConfig;

+ 191 - 0
src/views/subscribe/supplierBusinessAnalysis/components/demand-modify-modal.vue

@@ -0,0 +1,191 @@
+<script setup lang="ts">
+import { ElForm, ElMessage } from "element-plus";
+import { shallowRef, ref, onMounted, nextTick, watch } from "vue";
+import SupplierQuery from "/@/components/BasicForm/src/fields/supplier-permisson/index.vue";
+import DepartQuery from "/@/components/BasicForm/src/fields/depart.vue";
+import { useUserStore } from "/@/store/modules/user";
+import { isBeyondTime } from "../../_utils";
+import apis from "./config/apis";
+import dayjs from "dayjs";
+
+defineProps<{ isBusiness?: Boolean }>();
+
+const emit = defineEmits(["refresh"]);
+
+const visible = shallowRef(false);
+const loading = shallowRef(false);
+
+const deraptNameRef = ref("");
+const userStore = useUserStore();
+const businessQueryRef = ref<InstanceType<typeof BusinessQuery> | null>(null);
+const execList = ref<Array<Record<string, string>>>([]);
+
+const createInitialData = () => ({
+  date: [],
+  exec_id: "15",
+  companyNo: "",
+  depart_id: "0",
+  plat_type: "",
+  exec_type: "1"
+});
+
+const rules = {
+  date: [{ required: true, message: "请选择数据时间", trigger: "change" }],
+  exec_id: [{ required: true, message: "请输入业务表", trigger: "change" }],
+  depart_id: [{ required: true, message: "请选择所在部门", trigger: "change" }],
+  plat_type: [{ required: true, message: "请选择平台类型", trigger: "change" }],
+  companyNo: [{ required: true, message: "请选择业务公司", trigger: "change" }],
+  exec_type: [{ required: true, message: "请选择执行类型", trigger: "change" }]
+};
+
+const formRef = ref<InstanceType<typeof ElForm> | null>(null);
+const formData = ref({ ...createInitialData() });
+
+async function onSubmit() {
+  try {
+    await formRef.value?.validate();
+    const { date, companyNo ,...rest } = formData.value;
+    loading.value = true;
+
+    if (String(rest.exec_type) === "1") {
+      const beyondTime = isBeyondTime({
+        message: "立即执行时,时间区间不能超过31天!",
+        start: date[0],
+        end: date[1],
+        len: 31
+      });
+      if (beyondTime) return;
+    } else {
+      const beyondTime = isBeyondTime({
+        message: "延迟执行时,时间区间不能超过62天!",
+        start: date[0],
+        end: date[1],
+        len: 62
+      });
+      if (beyondTime) return;
+    }
+
+    const end1 = dayjs(date[1]).subtract(-1, "days");
+    const end = dayjs(end1).subtract(1, "days").format("YYYY-MM-DD");
+
+    const response = await apis.create_exec({
+      start: date[0] + " 00:00:00",
+      end: end + " 23:59:59",
+      supplierNo: companyNo,
+      companyNo,
+      ...rest
+    });
+
+    loading.value = false;
+
+    if (response.code === 1) {
+      visible.value = false;
+      emit("refresh");
+    } else {
+      ElMessage.warning(response.message);
+    }
+  } catch (error) {
+    console.log(error);
+  }
+}
+
+function handleClose() {
+  formData.value = createInitialData();
+  visible.value = false;
+}
+
+onMounted(async () => {
+  const response = await apis.exce_list({});
+  if (response.code !== 1) return;
+  execList.value = response.data.list;
+});
+
+
+defineExpose({
+  onDisplay: companyNo => {
+    visible.value = true;
+    nextTick(() => companyNo && businessQueryRef.value.initialData(companyNo));
+  }
+});
+</script>
+
+<template>
+  <el-dialog v-model="visible" title="修改报表需求" center @close="handleClose">
+    <el-form label-width="90px" :rules="rules" :model="formData" ref="formRef">
+      <el-form-item label="业务表:" prop="exec_id">
+        <el-select
+          v-model="formData.exec_id"
+          style="width: 100%"
+          placeholder="业务表"
+          disabled
+        >
+          <el-option
+            v-for="exec in execList"
+            :key="exec.id"
+            :label="exec.exec_name"
+            :value="exec.id"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="数据时间:" prop="date">
+        <el-date-picker
+          v-model="formData.date"
+          type="daterange"
+          value-format="YYYY-MM-DD"
+          range-separator="至"
+          start-placeholder="开始时间"
+          end-placeholder="结束时间"
+        />
+      </el-form-item>
+
+      <el-form-item label="执行类型" prop="exec_type">
+        <el-select
+          v-model="formData.exec_type"
+          placeholder="执行类型"
+          style="width: 100%"
+        >
+          <el-option value="1" label="立即执行" />
+          <el-option value="2" label="延迟执行" />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="供应商" prop="companyNo" v-if="isBusiness">
+        <SupplierQuery
+          ref="businessQueryRef"
+          :not-initial="true"
+          disabled
+          v-model="formData.companyNo"
+        />
+      </el-form-item>
+
+      <el-form-item>
+        <div class="w-full flex justify-between">
+          <el-alert
+            type="warning"
+            style="width: 260px; margin-right: 10px; padding: 0px"
+            size="small"
+            :closable="false"
+            v-if="String(formData.exec_type) === '1'"
+          >
+            立即执行:文件会在申请后几分钟内生成;
+          </el-alert>
+
+          <el-alert
+            type="warning"
+            style="width: 260px; margin-right: 10px; padding: 0px"
+            size="small"
+            :closable="false"
+            v-if="String(formData.exec_type) === '2'"
+          >
+            延迟执行:文件会在申请当天20:00开始执行;
+          </el-alert>
+
+          <el-button class="float-right" type="primary" @click="onSubmit"
+            >保存</el-button
+          >
+        </div>
+      </el-form-item>
+    </el-form>
+  </el-dialog>
+</template>

+ 41 - 0
src/views/subscribe/supplierBusinessAnalysis/components/exec-modal.vue

@@ -0,0 +1,41 @@
+<script setup lang="ts">
+import { ElForm, ElMessage } from "element-plus";
+import { shallowRef, ref, onMounted, nextTick, watch } from "vue";
+
+const visible = ref(false);
+
+const showTableData = [
+  { exceType: "立即", startTime: "申请后立即", report: "时间跨度短或数据量少" },
+  {
+    exceType: "延迟",
+    startTime: "申请当天20:00:00",
+    report: "时间跨度长或数据量多"
+  }
+];
+
+function handleClose() {
+  visible.value = false;
+}
+
+defineExpose({
+  onDisplay: () => {
+    visible.value = true;
+  }
+});
+</script>
+
+<template>
+  <el-dialog
+    v-model="visible"
+    title="执行类型说明"
+    width="380px"
+    center
+    @close="handleClose"
+  >
+    <el-table style="width: 330px" size="small" border :data="showTableData">
+      <el-table-column width="70px" label="执行类型" prop="exceType" />
+      <el-table-column width="120px" label="开始执行时间" prop="startTime" />
+      <el-table-column width="140px" label="适用报表" prop="report" />
+    </el-table>
+  </el-dialog>
+</template>

+ 48 - 0
src/views/subscribe/supplierBusinessAnalysis/index.vue

@@ -0,0 +1,48 @@
+<script setup lang="ts">
+import { shallowRef, onMounted } from "vue";
+import All from "./components/all.vue";
+import Business from "./components/business.vue";
+import { usePermission } from "/@/hooks/core";
+import NoAuth from "/@/components/NoAuth/NoAuth.vue";
+
+const pageName = "supplierBusinessAnalysis"
+const actived = shallowRef("");
+
+const { hasPermissionWithCode } = usePermission(pageName);
+
+// onMounted(() => {
+//   if (hasPermissionWithCode("3")) {
+//     actived.value = "3";
+//   } else if (hasPermissionWithCode("11")) {
+//     actived.value = "11";
+//   }
+// });
+</script>
+
+<template>
+  <div class="report-container">
+    <!-- <el-tabs v-model="actived" style="color: #fff" v-if="actived === '11'"> -->
+      <!-- <el-tab-pane label="查看全部" name="3" v-if="hasPermissionWithCode('3')">
+        <all v-if="actived === '3'" />
+      </el-tab-pane> -->
+      <!-- <el-tab-pane
+        name="11"
+        label="查看供应商"
+        v-if="hasPermissionWithCode('11')"
+      > -->
+        <business />
+      <!-- </el-tab-pane> -->
+    <!-- </el-tabs> -->
+    <!-- <no-auth v-else /> -->
+  </div>
+</template>
+
+<style scoped lang="scss">
+.report-container {
+  height: calc(100vh - 48px);
+  :deep(.el-tabs__header) {
+    background-color: #fff;
+    padding: 10px 10px 0;
+  }
+}
+</style>

+ 0 - 0
src/views/subscribe/supplierBusinessAnalysis/供应商经营分析报表


+ 9 - 3
src/views/subscribe/yongyou/components/config/apis.ts

@@ -4,10 +4,16 @@ const baseUrl = "admin/exec/";
 
 export default {
   list: createHttpRequest(`${baseUrl}listLog`, {
-    defaultData: { exec_id: 12 },
+    defaultData: { exec_id: 12, type: 1 },
+    url: ""
+  }),
+  exce_list: createHttpRequest(`${baseUrl}execList`, {
+    defaultData: { type: 1 },
+    url: ""
+  }),
+  create_exec: createHttpRequest(`${baseUrl}addExec`, {
+    defaultData: { type: 1 },
     url: ""
   }),
-  exce_list: createHttpRequest(`${baseUrl}execList`),
-  create_exec: createHttpRequest(`${baseUrl}addExec`),
   delete_exec: createHttpRequest(`${baseUrl}deleteLog`)
 };

+ 5 - 15
src/views/system/accountRole/index.vue

@@ -7,12 +7,11 @@ import { httpSetRole } from "/@/api/system/account";
 import { useAsync } from "/@/hooks/core/useAsync";
 import searchConfig from "./config/search.config";
 import { ElMessage, ElMessageBox } from "element-plus";
-import { ModalTypes } from "./types";
 import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
+import { ModalTypes } from "./types";
+
 
-import {
-  httpWxDel
-} from "/@/api/system/accountRole";
+import { httpWxDel } from "/@/api/system/accountRole";
 
 const PageName = "accountRole";
 const roleModalRef = ref<InstanceType<typeof RoleModal> | null>(null);
@@ -27,20 +26,13 @@ const hooks: PageHooks = {
   pageSearchHook: () => usePageSearch(searchCallback, undefined, searchConfig)
 };
 
-const { run } = useAsync({
-  success: () => instance.value.onSearch()
-});
+const { run } = useAsync({ success: () => instance.value.onSearch() });
 
 const events: PageEvents = {
   content: {
     create: () => roleModalRef.value.onDisplay(undefined, ModalTypes.create),
     preview: data => roleModalRef.value.onDisplay(data, ModalTypes.preview),
     update: data => {
-      if (Number(data.level) === 3) {
-        ElMessage.warning("供应商端账号不提供报表功能,不能设置角色!");
-        return;
-      }
-
       roleModalRef.value.onDisplay(data, ModalTypes.update);
     }
   }
@@ -49,9 +41,7 @@ const events: PageEvents = {
 async function delWx(id) { 
   ElMessageBox.confirm("是否确认解除绑定?").then(async () => { 
     const result = await httpWxDel({ id })
-    if (result.code === 1) { 
-        instance.value.onSearch()
-    }
+    if (result.code === 1) { instance.value.onSearch() }
   })
 }