import './dialog-permission.css' import { apiGet, apiPost, formCreatedUserAndModifiedUser, formInputClearable, formInputMultiFileStatic, horizontalFormOptions, information, inputFileFormItemCommonOptions, size100MB } from "../constants.js"; import {resourceList} from "../../pages/index/tab-data.js"; import {resourceDetailDialog} from "../resource/dialog-resource.js"; function detailForm(showCreatedUserAndModifiedUser = false) { return { debug: information.debug, id: 'permission_form', type: 'form', ...horizontalFormOptions(), horizontal: { left: 2, }, body: [ { type: 'hidden', name: 'id', }, { type: 'picker', name: 'targetId', label: '数据资源', required: true, multiple: false, size: 'md', valueField: 'id', labelField: 'name', source: apiGet('${base}/data_resource/list_no_authentication'), pickerSchema: { ...resourceList(), }, staticSchema: { type: 'tpl', tpl: "${targetName}", onEvent: { click: { actions: [ { actionType: 'dialog', ...resourceDetailDialog('targetId'), } ] } } } }, { type: 'textarea', placeholder: '请输入确权说明', label: '确权说明', name: 'description', ...formInputClearable, }, formInputMultiFileStatic('evidenceFiles', '相关材料'), { visibleOn: '${!detail}', type: 'input-file', label: '相关材料', name: 'evidenceFiles', multiple: true, required: true, joinValues: false, ...inputFileFormItemCommonOptions(undefined, size100MB), }, { type: 'input-datetime-range', name: 'activeTime', extraName: 'expiredTime', label: '授权时间', required: true, format: 'YYYY-MM-DD HH:mm:ss', shortcuts: [ '7dayslater', '14dayslater', '30dayslater', '180dayslater', '365dayslater', ] }, ...(showCreatedUserAndModifiedUser ? formCreatedUserAndModifiedUser() : []) ] } } export function authenticationAddDialog() { let data = {add: true, authentication: true} return { actionType: 'dialog', dialog: { title: '新增授权申请', size: 'md', actions: [ { type: 'reset', label: '重置', }, { type: 'submit', label: '确定', level: 'primary', } ], body: { ...detailForm(), api: apiPost(`\${base}/authentication/save`), data: data, } } } } export function authenticationDetailDialog(field = 'id', actions = []) { let data = {detail: true, authentication: true} return { actionType: 'dialog', dialog: { title: '授权申请详情', size: 'md', actions: actions, body: { ...detailForm(true), initApi: apiGet(`\${base}/authentication/detail/\${${field}}`), static: true, data: data, } } } } export function authenticationEditeDialog(field = 'id') { let data = {edit: true, authentication: true} return { actionType: 'dialog', dialog: { title: '授权申请详情', size: 'md', actions: [ { type: 'reset', label: '重置', }, { type: 'submit', label: '确定', level: 'primary', } ], body: { ...detailForm(), api: apiPost(`\${base}/authentication/save`), initApi: apiGet(`\${base}/authentication/detail/\${${field}}`), data: data, }, } } }