# Conflicts: # src/views/reporting/RepTemplate/components/Write.vuemain
commit
b55a799331
@ -0,0 +1,11 @@
|
||||
//指标计算类型
|
||||
export const INDEX_CATAGOTY_LIST = [
|
||||
{
|
||||
value:"1",
|
||||
label:"自动"
|
||||
},
|
||||
{
|
||||
value:"0",
|
||||
label:"手动"
|
||||
},
|
||||
]
|
@ -1,153 +1,147 @@
|
||||
<script setup lang="tsx">
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType, reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElButton, ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { Form, FormSchema } from '@/components/Form'
|
||||
import { useForm } from '@/hooks/web/useForm'
|
||||
import { PropType, reactive, watch } from 'vue'
|
||||
import { useValidator } from '@/hooks/web/useValidator'
|
||||
import { ElButton, ElMessage, ElMessageBox } from 'element-plus';
|
||||
|
||||
let fileChoose = null;
|
||||
const { required } = useValidator()
|
||||
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
},
|
||||
actionType: {
|
||||
type: String,
|
||||
default: 'add'
|
||||
}
|
||||
})
|
||||
const { required } = useValidator()
|
||||
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues, getFormData, getElFormExpose } = formMethods
|
||||
const props = defineProps({
|
||||
currentRow: {
|
||||
type: Object as PropType<any>,
|
||||
default: () => null
|
||||
},
|
||||
actionType: {
|
||||
type: String,
|
||||
default: 'add'
|
||||
}
|
||||
})
|
||||
|
||||
const formSchema = reactive < FormSchema[] > ([
|
||||
{
|
||||
field: 'tId',
|
||||
label: '编号',
|
||||
component: 'Input',
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
field: 'tCategory',
|
||||
label: '报告分类',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
const { formRegister, formMethods } = useForm()
|
||||
const { setValues, getFormData, getElFormExpose } = formMethods
|
||||
|
||||
},
|
||||
const formSchema = reactive<FormSchema[]>([
|
||||
{
|
||||
field: 'tId',
|
||||
label: '编号',
|
||||
component: 'Input',
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
field: 'tCategory',
|
||||
label: '报告分类',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
|
||||
},
|
||||
{
|
||||
field: 'createUser',
|
||||
label: '编写人',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'createUser',
|
||||
label: '编写人',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
|
||||
},
|
||||
{
|
||||
field: 'tVersion',
|
||||
label: '报告版本',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'tVersion',
|
||||
label: '报告版本',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
|
||||
},
|
||||
{
|
||||
field: 'tStatus',
|
||||
label: '报告状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'tStatus',
|
||||
label: '报告状态',
|
||||
component: 'Select',
|
||||
componentProps: {
|
||||
|
||||
},
|
||||
{
|
||||
field: 'tDescription',
|
||||
label: '报告描述',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
type: 'textarea'
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'tDescription',
|
||||
label: '报告描述',
|
||||
component: 'Input',
|
||||
colProps: { span: 24 },
|
||||
componentProps: {
|
||||
type: 'textarea'
|
||||
},
|
||||
{
|
||||
field: 'organCode',
|
||||
label: '报告模版',
|
||||
component: 'Upload',
|
||||
colProps: { span: 160 },
|
||||
componentProps: {
|
||||
limit: 1,
|
||||
drag: true,
|
||||
accept: ".doc,.docx",
|
||||
action: null,
|
||||
autoUpload:false,
|
||||
multiple: false,
|
||||
fileList: [],
|
||||
onPreview: (uploadFile) => {
|
||||
console.log(uploadFile)
|
||||
},
|
||||
onRemove: (file) => {
|
||||
console.log(file)
|
||||
},
|
||||
beforeRemove: (uploadFile) => {
|
||||
return ElMessageBox.confirm(`Cancel the transfer of ${uploadFile.name} ?`).then(
|
||||
() => true,
|
||||
() => false
|
||||
)
|
||||
},
|
||||
onExceed: (files, uploadFiles) => {
|
||||
ElMessage.warning(
|
||||
`The limit is 1, you selected ${files.length} files this time, add up to ${files.length + uploadFiles.length
|
||||
} 总共`
|
||||
)
|
||||
},
|
||||
slots: {
|
||||
default: () => <div class="el-upload"><div class="el-upload__text">拖曳报告模版到这里或<em>上传报告模版</em></div></div>,
|
||||
tip: () => <div class="el-upload__tip">doc,docx文件</div>,
|
||||
file: (file) => {
|
||||
fileChoose = file.file.raw;
|
||||
console.log(file, "file信息");
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
field: 'organCode',
|
||||
label: '报告模版',
|
||||
component: 'Upload',
|
||||
colProps: { span: 160 },
|
||||
componentProps: {
|
||||
limit: 1,
|
||||
drag:true,
|
||||
accept:".doc,.docx",
|
||||
action: 'https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15',
|
||||
multiple: true,
|
||||
onPreview: (uploadFile) => {
|
||||
console.log(uploadFile)
|
||||
},
|
||||
onRemove: (file) => {
|
||||
console.log(file)
|
||||
},
|
||||
beforeRemove: (uploadFile) => {
|
||||
return ElMessageBox.confirm(`Cancel the transfer of ${uploadFile.name} ?`).then(
|
||||
() => true,
|
||||
() => false
|
||||
)
|
||||
},
|
||||
}
|
||||
])
|
||||
onExceed: (files, uploadFiles) => {
|
||||
ElMessage.warning(
|
||||
`The limit is 1, you selected ${files.length} files this time, add up to ${
|
||||
files.length + uploadFiles.length
|
||||
} 总共`
|
||||
)
|
||||
},
|
||||
slots: {
|
||||
default: () =><div class="el-upload"><div class="el-upload__text">拖曳报告模版到这里或<em>上传报告模版</em></div></div>,
|
||||
tip: () => <div class="el-upload__tip">doc,docx文件</div>
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
])
|
||||
|
||||
const rules = reactive({
|
||||
const rules = reactive({
|
||||
|
||||
})
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
|
||||
const submit = async () => {
|
||||
const elForm = await getElFormExpose()
|
||||
const valid = await elForm?.validate().catch((err) => {
|
||||
console.log(err)
|
||||
})
|
||||
if (valid) {
|
||||
const formData = await getFormData()
|
||||
formData.file = fileChoose;
|
||||
console.log(formData);
|
||||
return formData
|
||||
}
|
||||
if (valid) {
|
||||
const formData = await getFormData()
|
||||
return formData
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
watch(
|
||||
() => props.currentRow,
|
||||
(currentRow) => {
|
||||
if (!currentRow) return
|
||||
setValues(currentRow)
|
||||
},
|
||||
{
|
||||
deep: true,
|
||||
immediate: true
|
||||
}
|
||||
)
|
||||
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
defineExpose({
|
||||
submit
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Form :rules="rules" @register="formRegister" :schema="formSchema" />
|
||||
</template>
|
||||
</template>
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
//报告状态选择列表
|
||||
export const REPORTING_STATUS_LIST = [
|
||||
{
|
||||
value:"1",
|
||||
label:"启用"
|
||||
},
|
||||
{
|
||||
value:"0",
|
||||
label:"停用"
|
||||
},
|
||||
]
|
Loading…
Reference in new issue