Browse Source

供应商管理接入审核流程

zhangcl 5 months ago
parent
commit
5c548cdcec

+ 84 - 1
src/api/supplier/base/index.ts

@@ -1,5 +1,4 @@
 import request from '@/config/axios'
-import {Sku} from "@/api/mall/product/spu";
 
 // 供应商主数据 VO
 export interface SupplierVO {
@@ -22,6 +21,79 @@ export interface SupplierVO {
   remark: string // 备注
 }
 
+// 供应商主数据 VO
+export interface SupplierApprovalVO {
+  id: number // 主键
+  code: string // 供应商编号 自动生成
+  name: string // 供应商名称
+  classification: string // 供应商分类
+  type: string // 公司类型
+  nature: string // 供应商性质
+  creditCode: string // 社会信用代码
+  tin: string // 纳税人识别号
+  corporation: string // 法人
+  incorporationDate: Date // 成立日期
+  address: string // 公司地址
+  bizScope: string // 经营范围
+  registeredCapital: number // 注册资金 单位:万元
+  annualTurnove: number // 年营业额 单位:万元
+  size: string // 公司规模 数据字典
+  status: number // 商品状态: 1 草稿 2活动 3 关闭
+  remark: string // 备注
+  certificates?: [
+    {
+      id: number
+      supplierId: number
+      supplierName: string
+      type: string
+      name: string
+      urls: string
+      createTime?: Date
+    }
+  ]
+  contacts?: [
+    {
+      id: number
+      supplierId: number
+      supplierName: string
+      name: string
+      position: string
+      telephone: string
+      email: string
+      productIds: number
+      productNames: string
+      remark: string
+      createTime?: Date
+    }
+  ]
+  coreProducts?: [
+    {
+      id: number
+      supplierId: number
+      supplierName: string
+      productId: number
+      productName: string
+      advantage: string
+      createTime?: Date
+    }
+  ]
+  connectRecords?: [
+    {
+      id: number
+      supplierId: number
+      supplierName: string
+      userId: number
+      username: string
+      contactId: number
+      contactName: string
+      reason: string
+      content: string
+      urls: string
+      createTime?: Date
+    }
+  ]
+}
+
 export interface Supplier {
   id?: number // 主键
   code?: string // 供应商编号 自动生成
@@ -54,6 +126,11 @@ export const Api = {
     return await request.get({ url: `/supplier/base/get?id=` + id })
   },
 
+  // 查询供应商主数据及所有子表详情
+  allSupplierInfo: async (id: number) => {
+    return await request.get({ url: `/supplier/base/allSupplierInfo?id=` + id })
+  },
+
   // 新增供应商主数据
   create: async (data: SupplierVO) => {
     return await request.post({ url: `/supplier/base/create`, data })
@@ -73,6 +150,12 @@ export const Api = {
   export: async (params) => {
     return await request.download({ url: `/supplier/base/export-excel`, params })
   },
+
+  // 提交审核
+  submitForApproval: async (id: number) => {
+    return await request.put({ url: `/supplier/base/submitForApproval?id=${id}`})
+  },
+
   getAll: async () =>{
     return await request.get({ url: `/supplier/base/all` })
   }

+ 79 - 0
src/views/supplier/approvaldetail/ApprovalDetail.vue

@@ -0,0 +1,79 @@
+<template>
+  <ContentWrap v-loading="formLoading">
+    <el-tabs >
+      <el-tab-pane label="基础信息" name="info">
+        <SupplierInfoForm
+          ref="infoRef"
+          :propFormData="formData"
+          :supplierId="{ id }"
+          @sendParam="handleParamTransfer"
+        />
+      </el-tab-pane>
+    </el-tabs>
+  </ContentWrap>
+</template>
+<script lang="ts" setup>
+import SupplierInfoForm from '@/views/supplier/base/form/SupplierInfoForm.vue'
+import {Api, SupplierApprovalVO, SupplierVO} from '@/api/supplier/base'
+
+
+defineOptions({ name: 'SupplierDetailInfo' })
+const props = defineProps<{ id?: number }>()
+const supplierId = ref(0) // 供应商id
+const { t } = useI18n() // 国际化
+const message = useMessage() // 消息弹窗
+const { params, name } = useRoute() // 查询参数
+const sharedParam = ref(params.id as unknown as number); // 用于存储从 Tab 1 传递到 Tab 2 的参数
+// 处理参数传递的方法
+const handleParamTransfer = (param) => {
+  sharedParam.value = param.id;
+};
+const loading = ref(true) // 加载中
+const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
+const infoRef = ref() // 供应商基本信息 Ref
+const id = params.id as unknown as number
+const supplierApprovalVO = ref<SupplierApprovalVO>({} as SupplierApprovalVO) // 详情
+
+// 供应商基本信息 表单数据
+const formData = ref({
+  id: undefined,
+  code: undefined,
+  name: undefined,
+  classification: undefined,
+  type: undefined,
+  nature: undefined,
+  creditCode: undefined,
+  tin: undefined,
+  corporation: undefined,
+  incorporationDate: undefined,
+  address: undefined,
+  bizScope: undefined,
+  registeredCapital: undefined,
+  annualTurnove: undefined,
+  size: undefined,
+  status: undefined,
+  remark: undefined,
+})
+
+/** 获取供应商基本信息详情 */
+const getSupplierData = async () => {
+  loading.value = true
+  try {
+    supplierApprovalVO.value = await Api.allSupplierInfo(supplierId.value)
+  } finally {
+    loading.value = false
+  }
+}
+
+/** 初始化 */
+onMounted(async () => {
+  const id = props.id || params.id
+  if (!id) {
+    message.warning('参数错误,合同不能为空!')
+    close()
+    return
+  }
+  supplierId.value = id as unknown as number
+  await getSupplierData()
+})
+</script>

+ 6 - 0
src/views/supplier/base/Form.vue

@@ -253,3 +253,9 @@ const resetForm = () => {
   formRef.value?.resetFields()
 }
 </script>
+
+<style lang="scss" scoped>
+.el-input__inner {
+  color: #0a0505;
+}
+</style>

+ 6 - 0
src/views/supplier/base/form/SupplierInfoForm.vue

@@ -344,3 +344,9 @@ onMounted(async () => {
   console.log(JSON.stringify(formData.value))
 })
 </script>
+
+<style lang="scss" scoped>
+.el-input__inner {
+  color: #0a0505;
+}
+</style>

+ 1 - 2
src/views/supplier/base/form/index.vue

@@ -67,7 +67,7 @@ import CoreList from '@/views/supplier/coreproduct/index.vue'
 import ConnectList from '@/views/supplier/connect/index.vue'
 import { Api, SupplierVO } from '@/api/supplier/base'
 
-defineOptions({ name: 'ProductSpuAdd' })
+defineOptions({ name: 'SupplierDetailInfo' })
 
 const { t } = useI18n() // 国际化
 const message = useMessage() // 消息弹窗
@@ -108,7 +108,6 @@ const getDetail = async () => {
   if ('SupplierDetailInfo' === name) {
     isDetail.value = true
   }
-  debugger;
   if (id) {
     formLoading.value = true
     try {

+ 17 - 0
src/views/supplier/base/index.vue

@@ -178,6 +178,9 @@
           >
             编辑
           </el-button>
+          <el-button
+            v-if="scope.row.auditStatus === 0"
+            link type="primary" @click="handleSubmit(scope.row)"> 提交审核 </el-button>
           <el-button
             link
             type="danger"
@@ -209,6 +212,7 @@ import Form from './Form.vue'
 import {DICT_TYPE, getIntDictOptions} from "@/utils/dict";
 import { useRoute, useRouter } from 'vue-router'
 import { watch } from 'vue'
+import * as ContractApi from "@/api/crm/contract";
 
 const route = useRoute()
 const router = useRouter() // 路由对象
@@ -299,6 +303,19 @@ const handleDelete = async (id: number) => {
   } catch {}
 }
 
+/** 提交审核按钮操作 */
+const handleSubmit = async (row: SupplierVO) => {
+  try {
+    // 提交审核的二次确认
+    await message.confirm(`您确定提交【${row.name}】审核吗?`)
+    // 提交审核
+    await Api.submitForApproval(row.id)
+    message.success('提交审核成功!')
+    // 刷新列表
+    await getList()
+  } catch {}
+}
+
 /** 导出按钮操作 */
 const handleExport = async () => {
   try {