hookehuyr

URL中可能带扩展字段提交表单

1 <!-- 1 <!--
2 * @Date: 2022-07-18 10:22:22 2 * @Date: 2022-07-18 10:22:22
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-02-16 10:18:37 4 + * @LastEditTime: 2023-02-22 10:56:40
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -148,6 +148,10 @@ const postData = ref({}); ...@@ -148,6 +148,10 @@ const postData = ref({});
148 148
149 // 编辑模式不能提交操作 149 // 编辑模式不能提交操作
150 const model = $route.query.model; 150 const model = $route.query.model;
151 +// 模仿金数据的扩展参数
152 +const x_field_1 = $route.query.x_field_1 ? $route.query.x_field_1 : null;
153 +// 周期ID标识
154 +const x_cycle = $route.query.x_cycle ? $route.query.x_cycle : null;
151 155
152 // 格式化表单数据结构 156 // 格式化表单数据结构
153 const formatData = (data) => { 157 const formatData = (data) => {
...@@ -456,7 +460,9 @@ const preValidData = (values) => { ...@@ -456,7 +460,9 @@ const preValidData = (values) => {
456 460
457 const onSubmit = async (values) => { 461 const onSubmit = async (values) => {
458 // 表单数据处理 462 // 表单数据处理
459 - postData.value = preValidData(values) 463 + postData.value = preValidData(values);
464 + // 合并扩展字段
465 + postData.value = { ...postData.value, x_field_1, x_cycle };
460 // 检查非表单输入项 466 // 检查非表单输入项
461 if (validOther().status) { 467 if (validOther().status) {
462 // 编辑模式不能提交数据 468 // 编辑模式不能提交数据
......