|
|
@@ -1,13 +1,13 @@
|
|
|
<template>
|
|
|
<div class="dm_ApplyDemo-container">
|
|
|
- <el-dialog v-model="isShowDialog" width="80%" draggable="">
|
|
|
+ <el-dialog v-model="isShowDialog" width="80%" draggable="">
|
|
|
<template #header>
|
|
|
<div style="color: #fff">
|
|
|
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
|
|
|
<span>{{ props.title }}</span>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <TableEditor :columns="editFormSchema" :v-model:value="vm.value" :rules="rules"></TableEditor>
|
|
|
+ <TableEditor :columns="editFormSchema" v-model:value="vm.value" :rules="rules"></TableEditor>
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
@@ -24,133 +24,105 @@
|
|
|
}
|
|
|
</style>
|
|
|
<script lang="ts" setup>
|
|
|
- import { ref,onMounted, reactive } from "vue";
|
|
|
- import { getDictDataItem as di, getDictDataListInt as dl } from '/@/utils/dict-utils';
|
|
|
- import { ElMessage } from "element-plus";
|
|
|
- import type { FormRules } from "element-plus";
|
|
|
- import { addDm_ApplyDemo, updateDm_ApplyDemo, detailDm_ApplyDemo } from "/@/api/main/dm_ApplyDemo";
|
|
|
- import TableEditor from "/@/components/table/TableEditor.vue";
|
|
|
-
|
|
|
- //父级传递来的参数
|
|
|
- var props = defineProps({
|
|
|
- title: {
|
|
|
+import { ref, onMounted, reactive } from 'vue';
|
|
|
+import { getDictDataItem as di, getDictDataListInt as dl } from '/@/utils/dict-utils';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import type { FormRules } from 'element-plus';
|
|
|
+import { patchAddDm_ApplyDemo} from '/@/api/main/dm_ApplyDemo';
|
|
|
+import TableEditor from '/@/components/table/TableEditor.vue';
|
|
|
+
|
|
|
+//父级传递来的参数
|
|
|
+var props = defineProps({
|
|
|
+ title: {
|
|
|
type: String,
|
|
|
- default: "",
|
|
|
+ default: '',
|
|
|
+ },
|
|
|
+});
|
|
|
+//父级传递来的函数,用于回调
|
|
|
+const emit = defineEmits(['reloadTable']);
|
|
|
+
|
|
|
+const isShowDialog = ref(false);
|
|
|
+//自行添加其他规则
|
|
|
+const rules = ref<FormRules>({
|
|
|
+ orgType: [{ required: true, message: '请输入机构类型!', trigger: 'blur' }],
|
|
|
+ applyNO: [{ required: true, message: '请输入申请号!', trigger: 'blur' }],
|
|
|
+ applicatDate: [{ required: true, message: '请选择申请时间!', trigger: 'change' }],
|
|
|
+ amount: [{ required: true, message: '请输入申请金额!', trigger: 'blur' }],
|
|
|
+ // remark: [{ required: true, message: '请输入备注!', trigger: 'blur',},],
|
|
|
+});
|
|
|
+const editFormSchema = [
|
|
|
+ {
|
|
|
+ label: 'id',
|
|
|
+ field: 'id',
|
|
|
+ component: 'el-input',
|
|
|
+ ifShow: false,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '机构类型',
|
|
|
+ field: 'orgType',
|
|
|
+ component: 'el-select',
|
|
|
+ componentProps: {
|
|
|
+ options: dl('org_type'),
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '申请号',
|
|
|
+ field: 'applyNO',
|
|
|
+ component: 'el-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '申请时间',
|
|
|
+ field: 'applicatDate',
|
|
|
+ component: 'el-date-picker',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '申请金额',
|
|
|
+ field: 'amount',
|
|
|
+ component: 'el-input-number',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '是否通知',
|
|
|
+ field: 'isNotice',
|
|
|
+ component: 'el-switch',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '备注',
|
|
|
+ field: 'remark',
|
|
|
+ component: 'el-input',
|
|
|
},
|
|
|
- });
|
|
|
- //父级传递来的函数,用于回调
|
|
|
- const emit = defineEmits(["reloadTable"]);
|
|
|
- const ruleFormRef = ref();
|
|
|
- const isShowDialog = ref(false);
|
|
|
- const ruleForm = ref<any>({});
|
|
|
- //自行添加其他规则
|
|
|
- const rules = ref<FormRules>({
|
|
|
- orgType: [{ required: true, message: '请输入机构类型!', trigger: 'blur',},],
|
|
|
- applyNO: [{ required: true, message: '请输入申请号!', trigger: 'blur',},],
|
|
|
- applicatDate: [{ required: true, message: '请选择申请时间!', trigger: 'change',},],
|
|
|
- amount: [{ required: true, message: '请输入申请金额!', trigger: 'blur',},],
|
|
|
- // remark: [{ required: true, message: '请输入备注!', trigger: 'blur',},],
|
|
|
- });
|
|
|
- const editFormSchema = [
|
|
|
- {
|
|
|
- label: 'id',
|
|
|
- field: 'id',
|
|
|
- component: 'el-input',
|
|
|
- ifShow: false,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '机构类型',
|
|
|
- field: 'orgType',
|
|
|
- component: 'el-select',
|
|
|
- componentProps: {
|
|
|
- options: dl('org_type'),
|
|
|
- },
|
|
|
- },
|
|
|
- {
|
|
|
- label: '申请号',
|
|
|
- field: 'applyNO',
|
|
|
- component: 'el-input',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '申请时间',
|
|
|
- field: 'applicatDate',
|
|
|
- component: 'el-date-picker',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '申请金额',
|
|
|
- field: 'amount',
|
|
|
- component: 'el-input-number',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '是否通知',
|
|
|
- field: 'isNotice',
|
|
|
- component: 'el-switch',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '备注',
|
|
|
- field: 'remark',
|
|
|
- component: 'el-input',
|
|
|
- },
|
|
|
];
|
|
|
|
|
|
-var vm = reactive({ value: [] as any[] });
|
|
|
- // 打开弹窗
|
|
|
- const openDialog = async (row: any) => {
|
|
|
- // ruleForm.value = JSON.parse(JSON.stringify(row));
|
|
|
- // 改用detail获取最新数据来编辑
|
|
|
- let rowData = JSON.parse(JSON.stringify(row));
|
|
|
- if (rowData.id)
|
|
|
- ruleForm.value = (await detailDm_ApplyDemo(rowData.id)).data.result;
|
|
|
- else
|
|
|
- ruleForm.value = rowData;
|
|
|
- isShowDialog.value = true;
|
|
|
- };
|
|
|
-
|
|
|
- // 关闭弹窗
|
|
|
- const closeDialog = () => {
|
|
|
- emit("reloadTable");
|
|
|
- isShowDialog.value = false;
|
|
|
- };
|
|
|
-
|
|
|
- // 取消
|
|
|
- const cancel = () => {
|
|
|
- isShowDialog.value = false;
|
|
|
- };
|
|
|
-
|
|
|
- // 提交
|
|
|
- const submit = async () => {
|
|
|
- ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
|
|
- if (isValid) {
|
|
|
- let values = ruleForm.value;
|
|
|
- if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
|
|
|
- await addDm_ApplyDemo(values);
|
|
|
- } else {
|
|
|
- await updateDm_ApplyDemo(values);
|
|
|
- }
|
|
|
- closeDialog();
|
|
|
- } else {
|
|
|
- ElMessage({
|
|
|
- message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
|
|
- type: "error",
|
|
|
- });
|
|
|
- }
|
|
|
+var vm = reactive({ value: [] as any[] });
|
|
|
+// 打开弹窗
|
|
|
+const openDialog = async (row: any) => {
|
|
|
+ isShowDialog.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+// 关闭弹窗
|
|
|
+const closeDialog = () => {
|
|
|
+ emit('reloadTable');
|
|
|
+ isShowDialog.value = false;
|
|
|
+};
|
|
|
+
|
|
|
+// 取消
|
|
|
+const cancel = () => {
|
|
|
+ isShowDialog.value = false;
|
|
|
+};
|
|
|
+
|
|
|
+// 提交
|
|
|
+const submit = async () => {
|
|
|
+ if(vm.value && vm.value.length>0){
|
|
|
+ await patchAddDm_ApplyDemo(vm.value).then((res:any)=>{
|
|
|
+ //vm.value=res;
|
|
|
+ console.log(res)
|
|
|
});
|
|
|
- };
|
|
|
+ closeDialog();
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
+// 页面加载时
|
|
|
+onMounted(async () => {});
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // 页面加载时
|
|
|
- onMounted(async () => {
|
|
|
- });
|
|
|
-
|
|
|
- //将属性或者函数暴露给父组件
|
|
|
- defineExpose({ openDialog });
|
|
|
+//将属性或者函数暴露给父组件
|
|
|
+defineExpose({ openDialog });
|
|
|
</script>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|