4 changed files with 199 additions and 118 deletions
@ -1,58 +1,79 @@ |
|||
<template> |
|||
<div> |
|||
<BasicModal |
|||
v-bind="$attrs" |
|||
@register="registerModal" |
|||
title="变更统计" |
|||
width="1200px" |
|||
:showOkBtn="false" |
|||
> |
|||
<BasicForm @register="registerchangeFieldForm" @submit="handleSubmit" /> |
|||
</div> |
|||
</BasicModal> |
|||
</template> |
|||
|
|||
<script lang="ts" name="changeFieldManageDetail" setup> |
|||
//ts语法 |
|||
import { defineProps, onMounted } from 'vue'; |
|||
import { useForm, BasicForm } from '@/components/Form'; |
|||
import { countStatisticsFormSchema } from './countStatistics.data' |
|||
import { modifyPeriodicallabCount, getperiodicallabById } from './countStatistics.api'; |
|||
|
|||
let emit = defineEmits(["exit"]) |
|||
let dataTo = defineProps(["id"]) |
|||
|
|||
onMounted(async () => { |
|||
let res = await getperiodicallabById({id: dataTo.id}) |
|||
console.log("结果是", res) |
|||
setFieldsValue(res) |
|||
}) |
|||
const [registerchangeFieldForm,{ getFieldsValue, validate, setFieldsValue }] = useForm({ |
|||
//注册表单列 |
|||
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()) { |
|||
let datas = await getFieldsValue() |
|||
await modifyPeriodicallabCount(datas) |
|||
emit("exit") |
|||
//ts语法 |
|||
import { ref, onMounted } from 'vue'; |
|||
import { useForm, BasicForm } from '@/components/Form'; |
|||
import { countStatisticsFormSchema } from './countStatistics.data'; |
|||
import { |
|||
modifyPeriodicallabCount, |
|||
getperiodicallabById, |
|||
addPeriodicallabCount, |
|||
} from './countStatistics.api'; |
|||
import { useModalInner, BasicModal } from '@/components/Modal'; |
|||
const [registerModal, { closeModal }] = useModalInner(init); |
|||
let id = ref(''); |
|||
let emit = defineEmits(['exit']); |
|||
async function init(dataTo) { |
|||
id.value = dataTo.id; |
|||
if (dataTo.id) { |
|||
let res = await getperiodicallabById({ id: dataTo.id }); |
|||
console.log('结果是', res); |
|||
setFieldsValue(res); |
|||
} |
|||
} |
|||
} |
|||
async function customResetFunc() { |
|||
emit("exit") |
|||
onMounted(async () => {}); |
|||
const [registerchangeFieldForm, { getFieldsValue, validate, setFieldsValue }] = useForm({ |
|||
//注册表单列 |
|||
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> |
|||
<style scoped></style> |
|||
<style scoped></style> |
|||
|
Loading…
Reference in new issue