feat(web-admin): register receiveAccount FormCreate control.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4e805f9625
commit
cf61ce340d
7 files changed
+435
No files matched your search
@@ -15,6 +15,7 @@ import { formatProgressPersonLines } from '@/utils/oa-progress-person-lines'
|
||||
import { formatDeptDisplay } from '@/utils/oa-dept-value'
|
||||
import { formatPersonDisplay } from '@/utils/oa-person-value'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { formatReceiveAccountDisplay } from '@/utils/oa-receive-account-value'
|
||||
import { toRmbUpper } from '@/utils/rmb-upper'
|
||||
|
||||
export const OA_PRINT_COMPANY_NAME = '安徽中科兴皖医学研究有限公司'
|
||||
@@ -274,6 +275,12 @@ async function walkRules(
|
||||
continue
|
||||
}
|
||||
|
||||
if (type === 'receiveAccount') {
|
||||
const text = formatReceiveAccountDisplay(value)
|
||||
out.push({ label, text: text || '-' })
|
||||
continue
|
||||
}
|
||||
|
||||
if (UPLOAD_TYPES.has(type) || String(rule.name || '').toLowerCase().includes('upload')) {
|
||||
const urls = extractUrls(value)
|
||||
out.push({ label, urls: urls.length ? urls : [], text: urls.length ? undefined : '-' })
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import FcDesigner from '@form-create/designer'
|
||||
import OaReceiveAccountSelect from '@/components/oa-approval/OaReceiveAccountSelect.vue'
|
||||
import { receiveAccountSelectDragRule } from '@/utils/oa-receive-account-rule'
|
||||
|
||||
const FLAG = '__oaReceiveAccountSelectConfigured'
|
||||
|
||||
export function setupOaReceiveAccountSelect(formCreate?: {
|
||||
component?: (name: string, c: unknown) => void
|
||||
}) {
|
||||
if ((FcDesigner as any)[FLAG]) return
|
||||
FcDesigner.component('receiveAccount', OaReceiveAccountSelect)
|
||||
if (typeof formCreate?.component === 'function') {
|
||||
formCreate.component('receiveAccount', OaReceiveAccountSelect)
|
||||
}
|
||||
if (typeof FcDesigner.addDragRule === 'function') {
|
||||
FcDesigner.addDragRule(receiveAccountSelectDragRule)
|
||||
}
|
||||
;(FcDesigner as any)[FLAG] = true
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/** 与 FormCreate 官方 unique 同类:生成不重复 field */
|
||||
let _uidSeq = 0
|
||||
function uniqueId() {
|
||||
const num = 370 + ++_uidSeq
|
||||
return (
|
||||
'F' +
|
||||
Math.random().toString(36).slice(3, 6) +
|
||||
Number(`${Date.now()}`).toString(36) +
|
||||
num.toString(36) +
|
||||
'r'
|
||||
)
|
||||
}
|
||||
|
||||
/** FormCreate Designer DragRule:收款账户选择 */
|
||||
export const receiveAccountSelectDragRule = {
|
||||
menu: 'main' as const,
|
||||
icon: 'icon-input',
|
||||
label: '收款账户',
|
||||
name: 'receiveAccount',
|
||||
input: true,
|
||||
mask: true,
|
||||
validate: ['string', 'array', 'object'],
|
||||
event: ['change'],
|
||||
rule() {
|
||||
return {
|
||||
type: 'receiveAccount',
|
||||
field: uniqueId(),
|
||||
title: '收款账户',
|
||||
info: '',
|
||||
$required: false,
|
||||
props: {
|
||||
multiple: true
|
||||
}
|
||||
}
|
||||
},
|
||||
props() {
|
||||
return [
|
||||
{
|
||||
type: 'input',
|
||||
field: 'formCreateInfo',
|
||||
title: '提示信息'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user