117 lines
3.3 KiB
Vue
117 lines
3.3 KiB
Vue
<!--
|
|
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
|
* No deletion without permission, or be held responsible to law.
|
|
* @author gaoxq
|
|
-->
|
|
<template>
|
|
<BasicModal
|
|
v-bind="$attrs"
|
|
:showFooter="true"
|
|
:showOkBtn="false"
|
|
@register="registerModal"
|
|
width="70%"
|
|
>
|
|
<template #title>
|
|
<Icon :icon="getTitle.icon" class="m-1 pr-1" />
|
|
<span> {{ getTitle.value }} </span>
|
|
</template>
|
|
<BasicForm @register="registerForm" >
|
|
<template #remarks>
|
|
<div
|
|
v-html="record?.scriptText"
|
|
style="border: 1px solid #dcdcdc; max-height: 300px; overflow-y: auto; line-height: 1.8; white-space: pre-wrap; padding: 8px; border-radius: 4px;"
|
|
/>
|
|
</template>
|
|
</BasicForm>
|
|
</BasicModal>
|
|
</template>
|
|
<script lang="ts" setup name="ViewsBizExecScriptForm">
|
|
import { ref, unref, computed } from 'vue';
|
|
import { useI18n } from '@jeesite/core/hooks/web/useI18n';
|
|
import { useMessage } from '@jeesite/core/hooks/web/useMessage';
|
|
import { router } from '@jeesite/core/router';
|
|
import { Icon } from '@jeesite/core/components/Icon';
|
|
import { BasicForm, FormSchema, useForm } from '@jeesite/core/components/Form';
|
|
import { BasicModal, useModalInner } from '@jeesite/core/components/Modal';
|
|
import { BizExecScript, bizExecScriptSave, bizExecScriptForm } from '@jeesite/biz/api/biz/execScript';
|
|
|
|
const emit = defineEmits(['success', 'register']);
|
|
|
|
const { t } = useI18n('biz.execScript');
|
|
const { showMessage } = useMessage();
|
|
const { meta } = unref(router.currentRoute);
|
|
const record = ref<BizExecScript>({} as BizExecScript);
|
|
|
|
const getTitle = computed(() => ({
|
|
icon: meta.icon || 'i-ant-design:book-outlined',
|
|
value: t('查看脚本信息'),
|
|
}));
|
|
|
|
const inputFormSchemas: FormSchema<BizExecScript>[] = [
|
|
{
|
|
label: t('脚本名称'),
|
|
field: 'scriptName',
|
|
component: 'Input',
|
|
componentProps: {
|
|
maxlength: 152,
|
|
},
|
|
colProps: { md: 24, lg: 24 },
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('数据库名称'),
|
|
field: 'dbId',
|
|
fieldLabel: 'dbName',
|
|
component: 'ListSelect',
|
|
componentProps: {
|
|
selectType: 'bizDbSelect',
|
|
},
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('数据状态'),
|
|
field: 'dataStatus',
|
|
component: 'Select',
|
|
componentProps: {
|
|
dictType: 'ustatus',
|
|
allowClear: true,
|
|
},
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('脚本描述'),
|
|
field: 'scriptDesc',
|
|
component: 'InputTextArea',
|
|
componentProps: {
|
|
maxlength: 152,
|
|
},
|
|
colProps: { md: 24, lg: 24 },
|
|
dynamicDisabled: true,
|
|
},
|
|
{
|
|
label: t('脚本内容'),
|
|
field: 'scriptText',
|
|
component: 'InputTextArea',
|
|
colProps: { md: 24, lg: 24 },
|
|
slot: 'remarks',
|
|
dynamicDisabled: true,
|
|
},
|
|
];
|
|
|
|
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm<BizExecScript>({
|
|
labelWidth: 120,
|
|
schemas: inputFormSchemas,
|
|
baseColProps: { md: 24, lg: 12 },
|
|
});
|
|
|
|
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
|
|
setModalProps({ loading: true });
|
|
await resetFields();
|
|
const res = await bizExecScriptForm(data);
|
|
record.value = (res.bizExecScript || {}) as BizExecScript;
|
|
record.value.__t = new Date().getTime();
|
|
await setFieldsValue(record.value);
|
|
setModalProps({ loading: false });
|
|
});
|
|
</script>
|