Jelajahi Sumber

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

Xiao_123 7 bulan lalu
induk
melakukan
df9a102ea9

+ 8 - 0
src/api/enterprise.js

@@ -141,6 +141,14 @@ export const getEnterpriseBusiness = async (params) => {
   })
 }
 
+// // 招聘端-根据企业名称模糊搜索企业营业执照信息
+// export const getEnterpriseBusinessByName = async (params) => {
+//   return await request.get({
+//     url: '/app-api/menduner/system/recruit/enterprise/business/search/by/name',
+//     params
+//   })
+// }
+
 // 招聘端-企业信息-修改企业logo
 export const updateEnterpriseLogo = async (url) => {
   return await request.post({

+ 56 - 17
src/views/recruit/enterprise/invoiceManagement/index.vue

@@ -62,6 +62,10 @@ const handleChangeCategory = (e) => {
   const type = formItems.value.options.find(item => item.key === 'type').value
   const code = formItems.value.options.find(item => item.key === 'code')
   code.hide = e ? false : true
+  if (e) setEntBusinessInfo()
+  else setEntPersonBaseInfo()
+  const title = formItems.value.options.find(item => item.key === 'title')
+  if (title) title.disabled = e ? true : false
   keys.forEach(k => {
     const result = formItems.value.options.find(item => item.key === k)
     result.label = (e && type) || (!e && type) ? `${result.defaultLabel} *` : result.defaultLabel
@@ -170,15 +174,6 @@ const formItems = ref({
   ]
 })
 
-// 获取企业工商信息
-const business = ref({})
-const getEnterpriseBusinessInfo = async () => {
-  const data = await getEnterpriseBusiness()
-  if (!data || !Object.keys(data).length) return
-  business.value = data
-}
-getEnterpriseBusinessInfo()
-
 // 获取列表
 const getList =async () => {
   const res = await getInvoiceTitlePage(query.value)
@@ -192,16 +187,60 @@ const handleChangePage = (e) => {
   getList()
 }
 
-// 新增
-const handleAdd = () => {
+// // // 根据企业名称模糊搜索企业营业执照信息-填充发票抬头
+// const getEntBusinessInfoByName = async (name) => {
+//   if (!name) return
+//   const data = await getEnterpriseBusinessByName({ name })
+//   if (!data?.length || !Object.keys(data[0]).length) return
+//   const info = {
+//     ...data[0],
+//     title: data[0].name,
+//   }
+//   formItems.value.options.forEach(e => e.value = info[e.key])
+// }
+
+
+// 获取企业工商信息
+const business = ref({})
+const getEnterpriseBusinessInfo = async () => {
+  const data = await getEnterpriseBusiness()
+  if (!data || !Object.keys(data).length) return
+  data.category = 1
+  data.title = data.name
+  business.value = data
+}
+getEnterpriseBusinessInfo()
+
+// 填充企业信息
+const setEntBusinessInfo = () => {
+  const info = business.value
   formItems.value.options.forEach(e => {
-    e.value = business.value[e.key] || null
-    if (e.key === 'title') e.value = business.value.name
-    if (e.key === 'category' || e.key === 'type') {
-      e.value = 0
-      e.change(e.value)
-    }
+    if (e.key === 'type') return
+    if ((info[e.key] || info[e.key] === 0) && e.key !== 'type') e.value = info[e.key]
+    else e.value = null
   })
+}
+
+// 填充个人信息
+const setEntPersonBaseInfo = () => {
+  const info = JSON.parse(localStorage.getItem('entBaseInfo')) || {}
+  info.title = info.name
+  info.category = 0
+  formItems.value.options.forEach(e => {
+    if (e.key === 'type') return
+    if ((info[e.key] || info[e.key] === 0) && e.key !== 'type') e.value = info[e.key]
+    else e.value = null
+  })
+}
+
+
+// 新增
+const handleAdd = () => {
+  // 初始化表单
+  handleChangeCategory(0)
+  handleChangeType(0)
+  // 赋值
+  setEntPersonBaseInfo()
   show.value = true
   editId.value = null
 }