|
@@ -62,6 +62,10 @@ const handleChangeCategory = (e) => {
|
|
const type = formItems.value.options.find(item => item.key === 'type').value
|
|
const type = formItems.value.options.find(item => item.key === 'type').value
|
|
const code = formItems.value.options.find(item => item.key === 'code')
|
|
const code = formItems.value.options.find(item => item.key === 'code')
|
|
code.hide = e ? false : true
|
|
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 => {
|
|
keys.forEach(k => {
|
|
const result = formItems.value.options.find(item => item.key === k)
|
|
const result = formItems.value.options.find(item => item.key === k)
|
|
result.label = (e && type) || (!e && type) ? `${result.defaultLabel} *` : result.defaultLabel
|
|
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 getList =async () => {
|
|
const res = await getInvoiceTitlePage(query.value)
|
|
const res = await getInvoiceTitlePage(query.value)
|
|
@@ -192,16 +187,60 @@ const handleChangePage = (e) => {
|
|
getList()
|
|
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 => {
|
|
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
|
|
show.value = true
|
|
editId.value = null
|
|
editId.value = null
|
|
}
|
|
}
|