parent
81fadef540
commit
3720832246
@ -0,0 +1,23 @@
|
||||
<script setup lang="tsx">
|
||||
import { ElTabs,ElTabPane } from 'element-plus';
|
||||
import ProcedureConfig from './components/ProcedureConfig.vue';
|
||||
import ParamConfig from './components/ParamConfig.vue';
|
||||
import BasicInfo from './components/BasicInfo.vue';
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<ElTabs tab-position="left" style="height: 200px">
|
||||
<ElTabPane label="存储过程">
|
||||
<ProcedureConfig ref="procedureConfig" />
|
||||
</ElTabPane>
|
||||
<ElTabPane label="参数配置">
|
||||
<ParamConfig ref="paramConfig" />
|
||||
</ElTabPane>
|
||||
<ElTabPane label="基本信息">
|
||||
<BasicInfo ref="basicInfo" />
|
||||
</ElTabPane>
|
||||
</ElTabs>
|
||||
</ContentWrap>
|
||||
</template>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'ss
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,23 @@
|
||||
<script setup lang="tsx">
|
||||
import { elTabs,elTabPane } from 'element-plus';
|
||||
import SQLRule from './components/SQLRule.vue';
|
||||
import SetParams from './components/SetParams.vue';
|
||||
import BasicInfo from './components/BasicInfo.vue';
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<elTabs tab-position="left" style="height: 200px">
|
||||
<elTabPane label="SQL">
|
||||
<SQLRule ref="sqlRule" />
|
||||
</elTabPane>
|
||||
<elTabPane label="参数配置">
|
||||
<SetParams ref="setParams" />
|
||||
</elTabPane>
|
||||
<elTabPane label="基本信息">
|
||||
<BasicInfo ref="basicInfo" />
|
||||
</elTabPane>
|
||||
</elTabs>
|
||||
</ContentWrap>
|
||||
</template>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'ss
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'ss
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,31 @@
|
||||
<script setup lang="tsx">
|
||||
import { elTabs,elTabPane } from 'element-plus';
|
||||
import SearchStucter from './components/SearchStucter.vue';
|
||||
import ParamConfig from './components/ParamConfig.vue';
|
||||
import FieldInfo from './components/FieldInfo.vue';
|
||||
import TargetPeek from './components/TargetPeek.vue'
|
||||
import BasicInfo from './components/BasicInfo.vue';
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<elTabs tab-position="left" style="height: 200px">
|
||||
<elTabPane label="查询结构">
|
||||
<SearchStucter ref="searchStucter" />
|
||||
</elTabPane>
|
||||
<elTabPane label="参数配置">
|
||||
<ParamConfig ref="paramConfig" />
|
||||
</elTabPane>
|
||||
<elTabPane label="字段信息">
|
||||
<FieldInfo ref="fieldInfo" />
|
||||
</elTabPane>
|
||||
<elTabPane label="指标取数">
|
||||
<TargetPeek ref="targetPeek" />
|
||||
</elTabPane>
|
||||
<elTabPane label="基本信息">
|
||||
<BasicInfo ref="basicInfo" />
|
||||
</elTabPane>
|
||||
</elTabs>
|
||||
</ContentWrap>
|
||||
</template>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'ss
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'ss
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'ss
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,105 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType,ref,reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElDialog } from 'element-plus'ss
|
||||
import {vue3CronPlus} from '@/views/vue3-cron-plus/index'
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
}
|
||||
})
|
||||
let showCron = ref(false);
|
||||
let NewCornData = "";//当前最新的corn语句的定义
|
||||
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'cron',
|
||||
label: '定时器信息',
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
},
|
||||
componentProps:{
|
||||
value:"",
|
||||
on:{
|
||||
click:()=>{
|
||||
NewCornData = formSchema[0].value;
|
||||
showCron.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
cron:[required()],
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues,getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData();
|
||||
formData.cron = formSchema[0].value;
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
//修改定时器的信息
|
||||
const changeCron = (corn)=>{
|
||||
formSchema[0].value = corn.toString();
|
||||
formSchema[0].componentProps.value = corn.toString();
|
||||
if(formSchema[0].value != '[object Event]'){
|
||||
NewCornData = formSchema[0].value
|
||||
}
|
||||
}
|
||||
const closeDialog = ()=>{
|
||||
if(NewCornData != formSchema[0].value){
|
||||
formSchema[0].value = NewCornData;
|
||||
formSchema[0].componentProps.value = NewCornData;
|
||||
}
|
||||
showCron.value = false;
|
||||
}
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
<ElDialog v-model="showCron">
|
||||
<vue3CronPlus
|
||||
i18n="cn"
|
||||
@change="changeCron"
|
||||
@close="closeDialog"
|
||||
max-height="300px"
|
||||
/>
|
||||
</ElDialog>
|
||||
</template>
|
||||
<style scoped>
|
||||
.vue3-cron-plus-container>>>.language{
|
||||
top:40px !important;
|
||||
}
|
||||
</style>
|
@ -1,20 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { PropType } from 'vue'
|
||||
import type { TableData } from '@/api/table/types'
|
||||
import { Descriptions, DescriptionsSchema } from '@/components/Descriptions'
|
||||
|
||||
defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<Nullable<TableData>>,
|
||||
default: () => null
|
||||
},
|
||||
detailSchema: {
|
||||
type: Array as PropType<DescriptionsSchema[]>,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Descriptions :schema="detailSchema" :data="currentRow || {}" />
|
||||
</template>
|
@ -1,63 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType, reactive, watch } from 'vue'
|
||||
import { TableData } from '@/api/table/types'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<Nullable<TableData>>,
|
||||
default: () => null
|
||||
},
|
||||
formSchema: {
|
||||
type: Array as PropType<FormSchema[]>,
|
||||
default: () => []
|
||||
}
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
title: [required()],
|
||||
author: [required()],
|
||||
importance: [required()],
|
||||
pageviews: [required()],
|
||||
display_time: [required()],
|
||||
content: [required()]
|
||||
})
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues, getFormData, getElFormExpose } = formMethods
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData()
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
</template>
|
@ -1,255 +0,0 @@
|
||||
<script setup lang="tsx">
|
||||
import { ContentWrap } from '@/components/ContentWrap'
|
||||
import { Search } from '@/components/Search'
|
||||
import { Dialog } from '@/components/Dialog'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { ElButton, ElTag, ElLink, ElPopconfirm } from 'element-plus'
|
||||
import { Table } from '@/components/Table'
|
||||
import { getTableListApi, saveTableApi, delTableListApi } from '@/api/table'
|
||||
import { useTable } from '@/hooks/web/useTable'
|
||||
import { TableData } from '@/api/table/types'
|
||||
import { ref, unref, reactive } from 'vue'
|
||||
import Write from './components/Write.vue'
|
||||
import Detail from './components/Detail.vue'
|
||||
import { CrudSchema, useCrudSchemas } from '@/hooks/web/useCrudSchemas'
|
||||
|
||||
defineOptions({
|
||||
name: 'Demo'
|
||||
})
|
||||
|
||||
const ids = ref<string[]>([])
|
||||
|
||||
const { tableRegister, tableState, tableMethods } = useTable({
|
||||
fetchDataApi: async () => {
|
||||
const { currentPage, pageSize } = tableState
|
||||
const res = await getTableListApi({
|
||||
pageNum: unref(currentPage),
|
||||
pageSize: unref(pageSize),
|
||||
...unref(searchParams)
|
||||
})
|
||||
return {
|
||||
list: res.data.list,
|
||||
total: res.data.total
|
||||
}
|
||||
},
|
||||
fetchDelApi: async () => {
|
||||
const res = await delTableListApi(unref(ids))
|
||||
return !!res
|
||||
}
|
||||
})
|
||||
const { loading, dataList, total, currentPage, pageSize } = tableState
|
||||
const { getList, getElTableExpose, delList, refresh } = tableMethods
|
||||
|
||||
const searchParams = ref({})
|
||||
const setSearchParams = (params: any) => {
|
||||
searchParams.value = params
|
||||
getList()
|
||||
}
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
const crudSchemas = reactive<CrudSchema[]>([
|
||||
{
|
||||
field: 'selection',
|
||||
search: {
|
||||
hidden: true
|
||||
},
|
||||
form: {
|
||||
hidden: true
|
||||
},
|
||||
detail: {
|
||||
hidden: true
|
||||
},
|
||||
table: {
|
||||
type: 'selection'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'index',
|
||||
label: t('tableDemo.index'),
|
||||
type: 'index',
|
||||
search: {
|
||||
hidden: true
|
||||
},
|
||||
form: {
|
||||
hidden: true
|
||||
},
|
||||
detail: {
|
||||
hidden: true
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'title',
|
||||
label: t('tableDemo.title'),
|
||||
search: {
|
||||
component: 'Input'
|
||||
},
|
||||
form: {
|
||||
component: 'Input',
|
||||
colProps: {
|
||||
span: 24
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
span: 24
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
width: '260px',
|
||||
label: t('tableDemo.action'),
|
||||
search: {
|
||||
hidden: true
|
||||
},
|
||||
form: {
|
||||
hidden: true
|
||||
},
|
||||
detail: {
|
||||
hidden: true
|
||||
},
|
||||
table: {
|
||||
slots: {
|
||||
default: (data: any) => {
|
||||
return (
|
||||
<>
|
||||
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'edit')}>
|
||||
{t('exampleDemo.edit')}
|
||||
</ElLink>
|
||||
<ElLink type="primary" underline={false} onClick={() => action(data.row, 'detail')}>
|
||||
{t('exampleDemo.detail')}
|
||||
</ElLink>
|
||||
<ElPopconfirm
|
||||
title={t('common.delTableMsg')}
|
||||
width={200}
|
||||
v-slots={{
|
||||
reference: () => {
|
||||
return (
|
||||
<>
|
||||
<ElLink type="primary" underline={false}>
|
||||
{t('exampleDemo.del')}
|
||||
</ElLink>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}}
|
||||
onConfirm={() => delData(data.row)}
|
||||
></ElPopconfirm>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
// @ts-ignore
|
||||
const { allSchemas } = useCrudSchemas(crudSchemas)
|
||||
|
||||
const dialogVisible = ref(false)
|
||||
const dialogTitle = ref('')
|
||||
|
||||
const currentRow = ref<TableData | null>(null)
|
||||
const actionType = ref('')
|
||||
|
||||
const AddAction = () => {
|
||||
dialogTitle.value = t('exampleDemo.add')
|
||||
currentRow.value = null
|
||||
dialogVisible.value = true
|
||||
actionType.value = ''
|
||||
}
|
||||
|
||||
const delLoading = ref(false)
|
||||
|
||||
const delData = async (row: TableData | null) => {
|
||||
const elTableExpose = await getElTableExpose()
|
||||
ids.value = row ? [row.id] : elTableExpose?.getSelectionRows().map((v: TableData) => v.id) || []
|
||||
delLoading.value = true
|
||||
await delList(unref(ids).length).finally(() => {
|
||||
delLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
const action = (row: TableData, type: string) => {
|
||||
dialogTitle.value = t(type === 'edit' ? 'exampleDemo.edit' : 'exampleDemo.detail')
|
||||
actionType.value = type
|
||||
currentRow.value = row
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const writeRef = ref<ComponentRef<typeof Write>>()
|
||||
|
||||
const saveLoading = ref(false)
|
||||
|
||||
const save = async () => {
|
||||
const write = unref(writeRef)
|
||||
const formData = await write?.submit()
|
||||
if (formData) {
|
||||
saveLoading.value = true
|
||||
const res = await saveTableApi(formData)
|
||||
.catch(() => {})
|
||||
.finally(() => {
|
||||
saveLoading.value = false
|
||||
})
|
||||
if (res) {
|
||||
dialogVisible.value = false
|
||||
currentPage.value = 1
|
||||
getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const disabled = ref(true)
|
||||
|
||||
const onSelectionChange = (selection: any[]) => {
|
||||
disabled.value = selection.length === 0
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<Search :schema="allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
|
||||
|
||||
<Table
|
||||
v-model:pageSize="pageSize"
|
||||
v-model:currentPage="currentPage"
|
||||
:columns="allSchemas.tableColumns"
|
||||
:data="dataList"
|
||||
:loading="loading"
|
||||
:pagination="{
|
||||
total: total
|
||||
}"
|
||||
@register="tableRegister"
|
||||
@refresh="refresh"
|
||||
@selection-change="onSelectionChange"
|
||||
>
|
||||
<template #buttons>
|
||||
<ElButton type="primary" @click="AddAction">{{ t('exampleDemo.add') }}</ElButton>
|
||||
<ElButton :loading="delLoading" type="primary" :disabled="disabled" @click="delData(null)">
|
||||
{{ t('exampleDemo.del') }}
|
||||
</ElButton>
|
||||
</template>
|
||||
</Table>
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="dialogVisible" :title="dialogTitle">
|
||||
<Write
|
||||
v-if="actionType !== 'detail'"
|
||||
ref="writeRef"
|
||||
:form-schema="allSchemas.formSchema"
|
||||
:current-row="currentRow"
|
||||
/>
|
||||
|
||||
<Detail
|
||||
v-if="actionType === 'detail'"
|
||||
:detail-schema="allSchemas.detailSchema"
|
||||
:current-row="currentRow"
|
||||
/>
|
||||
|
||||
<template #footer>
|
||||
<ElButton v-if="actionType !== 'detail'" type="primary" :loading="saveLoading" @click="save">
|
||||
{{ t('exampleDemo.save') }}
|
||||
</ElButton>
|
||||
<ElButton @click="dialogVisible = false">{{ t('dialogDemo.close') }}</ElButton>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
Loading…
Reference in new issue