| | |
| | | <script setup name="Config" lang="ts"> |
| | | import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config"; |
| | | import { ConfigForm, ConfigQuery, ConfigVO } from "@/api/system/config/types"; |
| | | import { ComponentInternalInstance } from "vue"; |
| | | import { DateModelType } from 'element-plus'; |
| | | |
| | | const { proxy } = getCurrentInstance() as ComponentInternalInstance; |
| | | const { sys_yes_no } = toRefs<any>(proxy?.useDict("sys_yes_no")); |
| | |
| | | const total = ref(0); |
| | | const dateRange = ref<[DateModelType, DateModelType]>(['', '']); |
| | | |
| | | const queryFormRef = ref(ElForm); |
| | | const configFormRef = ref(ElForm); |
| | | const queryFormRef = ref<ElFormInstance>(); |
| | | const configFormRef = ref<ElFormInstance>(); |
| | | const dialog = reactive<DialogOption>({ |
| | | visible: false, |
| | | title: '' |
| | |
| | | /** 表单重置 */ |
| | | const reset = () => { |
| | | form.value = {...initFormData}; |
| | | configFormRef.value.resetFields(); |
| | | configFormRef.value?.resetFields(); |
| | | } |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | |
| | | /** 重置按钮操作 */ |
| | | const resetQuery = () => { |
| | | dateRange.value = ['', '']; |
| | | queryFormRef.value.resetFields(); |
| | | queryFormRef.value?.resetFields(); |
| | | handleQuery(); |
| | | } |
| | | /** 多选框选中数据 */ |
| | |
| | | } |
| | | /** 提交按钮 */ |
| | | const submitForm = () => { |
| | | configFormRef.value.validate(async (valid: boolean) => { |
| | | configFormRef.value?.validate(async (valid: boolean) => { |
| | | if (valid) { |
| | | form.value.configId ? await updateConfig(form.value) : await addConfig(form.value); |
| | | proxy?.$modal.msgSuccess("操作成功"); |
| | | dialog.visible = false; |
| | | getList(); |
| | | await getList(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | const configIds = row?.configId || ids.value; |
| | | await proxy?.$modal.confirm('是否确认删除参数编号为"' + configIds + '"的数据项?'); |
| | | await delConfig(configIds); |
| | | getList(); |
| | | await getList(); |
| | | proxy?.$modal.msgSuccess("删除成功"); |
| | | } |
| | | /** 导出按钮操作 */ |