|
@@ -109,6 +109,9 @@ const currentTenantId = computed(() => queryParams.tenantIds?.[0])
|
|
|
/** 是否集团账号:集团账号可切换院区,普通院区账号固定为当前院区 */
|
|
/** 是否集团账号:集团账号可切换院区,普通院区账号固定为当前院区 */
|
|
|
const canSwitchTenant = computed(() => !!userStore.getOrgTenant?.multiple)
|
|
const canSwitchTenant = computed(() => !!userStore.getOrgTenant?.multiple)
|
|
|
|
|
|
|
|
|
|
+/** 内容换行处理:兼容后端存的字面量 \n */
|
|
|
|
|
+const normalizeContent = (content?: string) => (content || '').replace(/\\n/g, '\n')
|
|
|
|
|
+
|
|
|
/** 按机构查询须知(返回第一条) */
|
|
/** 按机构查询须知(返回第一条) */
|
|
|
const fetchDetail = async () => {
|
|
const fetchDetail = async () => {
|
|
|
const list = await getNoticeCustomerList({
|
|
const list = await getNoticeCustomerList({
|
|
@@ -125,8 +128,12 @@ const fetchDetail = async () => {
|
|
|
*/
|
|
*/
|
|
|
const initNotice = async () => {
|
|
const initNotice = async () => {
|
|
|
try {
|
|
try {
|
|
|
- const defaultList = await getNoticeCustomerList({ type: NOTICE_TYPE })
|
|
|
|
|
- const initContent = defaultList?.[0]?.content
|
|
|
|
|
|
|
+ const defaultList = await getNoticeCustomerList({ type: NOTICE_TYPE, tenantId: 1 })
|
|
|
|
|
+ // 初始数据可能返回多条,用 \n 拼接后展示
|
|
|
|
|
+ const initContent = (defaultList || [])
|
|
|
|
|
+ .map((item) => normalizeContent(item?.content))
|
|
|
|
|
+ .filter((item) => item.trim())
|
|
|
|
|
+ .join('\n')
|
|
|
if (!initContent) {
|
|
if (!initContent) {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
@@ -152,7 +159,7 @@ const getDetail = async () => {
|
|
|
const detail = await fetchDetail()
|
|
const detail = await fetchDetail()
|
|
|
if (detail) {
|
|
if (detail) {
|
|
|
formData.id = detail.id
|
|
formData.id = detail.id
|
|
|
- formData.content = detail.content || ''
|
|
|
|
|
|
|
+ formData.content = normalizeContent(detail.content)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
// 机构下无数据 -> 自动初始化后再查一次回填
|
|
// 机构下无数据 -> 自动初始化后再查一次回填
|
|
@@ -160,7 +167,7 @@ const getDetail = async () => {
|
|
|
if (created) {
|
|
if (created) {
|
|
|
const newDetail = await fetchDetail()
|
|
const newDetail = await fetchDetail()
|
|
|
formData.id = newDetail?.id
|
|
formData.id = newDetail?.id
|
|
|
- formData.content = newDetail?.content || ''
|
|
|
|
|
|
|
+ formData.content = normalizeContent(newDetail?.content)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
formData.id = undefined
|
|
formData.id = undefined
|