4 changed files with 199 additions and 118 deletions
@ -1,58 +1,79 @@ |
|||||
<template> |
<template> |
||||
<div> |
<BasicModal |
||||
|
v-bind="$attrs" |
||||
|
@register="registerModal" |
||||
|
title="变更统计" |
||||
|
width="1200px" |
||||
|
:showOkBtn="false" |
||||
|
> |
||||
<BasicForm @register="registerchangeFieldForm" @submit="handleSubmit" /> |
<BasicForm @register="registerchangeFieldForm" @submit="handleSubmit" /> |
||||
</div> |
</BasicModal> |
||||
</template> |
</template> |
||||
|
|
||||
<script lang="ts" name="changeFieldManageDetail" setup> |
<script lang="ts" name="changeFieldManageDetail" setup> |
||||
//ts语法 |
//ts语法 |
||||
import { defineProps, onMounted } from 'vue'; |
import { ref, onMounted } from 'vue'; |
||||
import { useForm, BasicForm } from '@/components/Form'; |
import { useForm, BasicForm } from '@/components/Form'; |
||||
import { countStatisticsFormSchema } from './countStatistics.data' |
import { countStatisticsFormSchema } from './countStatistics.data'; |
||||
import { modifyPeriodicallabCount, getperiodicallabById } from './countStatistics.api'; |
import { |
||||
|
modifyPeriodicallabCount, |
||||
let emit = defineEmits(["exit"]) |
getperiodicallabById, |
||||
let dataTo = defineProps(["id"]) |
addPeriodicallabCount, |
||||
|
} from './countStatistics.api'; |
||||
onMounted(async () => { |
import { useModalInner, BasicModal } from '@/components/Modal'; |
||||
let res = await getperiodicallabById({id: dataTo.id}) |
const [registerModal, { closeModal }] = useModalInner(init); |
||||
console.log("结果是", res) |
let id = ref(''); |
||||
setFieldsValue(res) |
let emit = defineEmits(['exit']); |
||||
}) |
async function init(dataTo) { |
||||
const [registerchangeFieldForm,{ getFieldsValue, validate, setFieldsValue }] = useForm({ |
id.value = dataTo.id; |
||||
//注册表单列 |
if (dataTo.id) { |
||||
schemas: countStatisticsFormSchema, |
let res = await getperiodicallabById({ id: dataTo.id }); |
||||
//自定义查询按钮的文本和图标 |
console.log('结果是', res); |
||||
// submitButtonOptions: { text: '提交', preIcon: '' }, |
setFieldsValue(res); |
||||
//自定义重置按钮的文本和图标 |
} |
||||
resetButtonOptions: { text: '取消' }, |
|
||||
// showActionButtonGroup: false, |
|
||||
//回车提交 |
|
||||
// autoSubmitOnEnter: true, |
|
||||
// //不显示重置按钮 |
|
||||
// showResetButton: false, |
|
||||
//自定义提交按钮文本和图标 |
|
||||
submitButtonOptions: { text: '提交' }, |
|
||||
//查询列占比 24代表一行 取值范围 0-24 |
|
||||
actionColOptions: { span: 14 }, |
|
||||
//提交按钮的自定义事件 |
|
||||
// submitFunc: customSubmitFunc, |
|
||||
//重置按钮的自定义时间 |
|
||||
resetFunc: customResetFunc, |
|
||||
labelCol: { style: { width: '120px' } }, |
|
||||
wrapperCol: { style: { width: 'auto' } }, |
|
||||
// disabled:true |
|
||||
}) |
|
||||
async function handleSubmit() { |
|
||||
if (await validate()) { |
|
||||
let datas = await getFieldsValue() |
|
||||
await modifyPeriodicallabCount(datas) |
|
||||
emit("exit") |
|
||||
} |
} |
||||
} |
onMounted(async () => {}); |
||||
async function customResetFunc() { |
const [registerchangeFieldForm, { getFieldsValue, validate, setFieldsValue }] = useForm({ |
||||
emit("exit") |
//注册表单列 |
||||
|
schemas: countStatisticsFormSchema, |
||||
|
//自定义查询按钮的文本和图标 |
||||
|
// submitButtonOptions: { text: '提交', preIcon: '' }, |
||||
|
//自定义重置按钮的文本和图标 |
||||
|
resetButtonOptions: { text: '取消' }, |
||||
|
// showActionButtonGroup: false, |
||||
|
//回车提交 |
||||
|
// autoSubmitOnEnter: true, |
||||
|
// //不显示重置按钮 |
||||
|
// showResetButton: false, |
||||
|
//自定义提交按钮文本和图标 |
||||
|
submitButtonOptions: { text: '提交' }, |
||||
|
//查询列占比 24代表一行 取值范围 0-24 |
||||
|
actionColOptions: { span: 14 }, |
||||
|
//提交按钮的自定义事件 |
||||
|
// submitFunc: customSubmitFunc, |
||||
|
//重置按钮的自定义时间 |
||||
|
resetFunc: customResetFunc, |
||||
|
labelCol: { style: { width: '120px' } }, |
||||
|
wrapperCol: { style: { width: 'auto' } }, |
||||
|
// disabled:true |
||||
|
}); |
||||
|
async function handleSubmit() { |
||||
|
if (await validate()) { |
||||
|
if (id.value) { |
||||
|
let datas = await getFieldsValue(); |
||||
|
await modifyPeriodicallabCount(datas); |
||||
|
} else { |
||||
|
let datas = await getFieldsValue(); |
||||
|
await addPeriodicallabCount(datas); |
||||
|
} |
||||
|
|
||||
} |
emit('exit'); |
||||
|
closeModal() |
||||
|
} |
||||
|
} |
||||
|
async function customResetFunc() { |
||||
|
emit('exit'); |
||||
|
closeModal() |
||||
|
} |
||||
</script> |
</script> |
||||
<style scoped></style> |
<style scoped></style> |
||||
|
Loading…
Reference in new issue