hookehuyr

编辑模式不能提交数据

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: 2022-12-08 14:57:55 4 + * @LastEditTime: 2022-12-08 17:54:44
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -44,10 +44,7 @@ ...@@ -44,10 +44,7 @@
44 /> 44 />
45 </van-cell-group> 45 </van-cell-group>
46 <div v-if="formData.length" style="margin: 16px"> 46 <div v-if="formData.length" style="margin: 16px">
47 - <van-button v-if="model === 'edit'" round block type="primary"> 47 + <van-button round block type="primary" native-type="submit">
48 - {{ PCommit.text ? PCommit.text : '提交' }}
49 - </van-button>
50 - <van-button v-else round block type="primary" native-type="submit">
51 {{ PCommit.text ? PCommit.text : '提交' }} 48 {{ PCommit.text ? PCommit.text : '提交' }}
52 </van-button> 49 </van-button>
53 </div> 50 </div>
...@@ -407,6 +404,8 @@ const onSubmit = async (values) => { ...@@ -407,6 +404,8 @@ const onSubmit = async (values) => {
407 postData.value = _.assign(postData.value, rest_data); 404 postData.value = _.assign(postData.value, rest_data);
408 // 检查非表单输入项 405 // 检查非表单输入项
409 if (validOther().status) { 406 if (validOther().status) {
407 + // 编辑模式不能提交数据
408 + if (model === 'edit') return false;
410 // 通过验证 409 // 通过验证
411 const result = await addFormDataAPI({ 410 const result = await addFormDataAPI({
412 form_code: $route.query.code, 411 form_code: $route.query.code,
......