| | |
| | | } |
| | | ]) |
| | | const dialogAddForm = ref(false); |
| | | |
| | | // 判断新增修改参数 |
| | | const rowIndex = ref(-1) |
| | | |
| | | const reportForm = ref({ |
| | | type: '', |
| | | founder: '', |
| | |
| | | editor: '', |
| | | editeTime: '' |
| | | }) |
| | | |
| | | // 时间格式化 |
| | | const timeForm = { |
| | | hour12: false, |
| | | year: 'numeric', |
| | |
| | | minute: '2-digit', |
| | | second: '2-digit' |
| | | } |
| | | |
| | | // 新增记录 |
| | | const addReport = ()=>{ |
| | | dialogAddForm.value = true |
| | | }; |
| | | |
| | | const ruleFormRef = ref<FormInstance>() |
| | | const addRules = reactive<FormRules>({ |
| | | type:[{required: true, message: '该内容不能为空',trigger:'blur'}], |
| | | founder:[{required: true, message: '该内容不能为空',trigger:'blur'}], |
| | | editor:[{required: true, message: '该内容不能为空',trigger:'blur'}] |
| | | }) |
| | | |
| | | // 新增修改记录确认 |
| | | const onSubmitAddForm = async (formEl: FormInstance | undefined) => { |
| | | if (!formEl) return |
| | | await formEl.validate((valid, fields) => { |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 修改记录 |
| | | const editeRow = (index: number, row: User) =>{ |
| | | dialogAddForm.value = true |
| | | rowIndex.value = index |
| | | reportForm.value = JSON.parse(JSON.stringify(row)) |
| | | } |
| | | |
| | | // 删除记录 |
| | | const deleteRow = (index)=>{ |
| | | tableData.splice( index,1) |
| | | } |
| | | |
| | | // 弹窗关闭数据初始化 |
| | | const dialogColse = () =>{ |
| | | reportForm.value = { |
| | | type: '', |