From bba507067b37d68bb3057e0d821ddea0043d8357 Mon Sep 17 00:00:00 2001
From: zhc077 <565291854@qq.com>
Date: Fri, 23 Aug 2024 15:42:24 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=A2=E9=98=9F=E8=B5=9B=E9=98=9F=E5=91=98?=
=?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/AnnualCompPointForm.vue | 99 +++++++++++++++++--
1 file changed, 92 insertions(+), 7 deletions(-)
diff --git a/jeecgboot-vue3-master/src/views/annualCompPoint/committee/components/AnnualCompPointForm.vue b/jeecgboot-vue3-master/src/views/annualCompPoint/committee/components/AnnualCompPointForm.vue
index 5a4324b9..07fb9419 100644
--- a/jeecgboot-vue3-master/src/views/annualCompPoint/committee/components/AnnualCompPointForm.vue
+++ b/jeecgboot-vue3-master/src/views/annualCompPoint/committee/components/AnnualCompPointForm.vue
@@ -302,14 +302,27 @@
@register="register"
title="Modal Title"
>
-
- 从内部关闭弹窗
+
+
+
+
+
+
- 从内部修改title
+
+
@@ -325,6 +338,78 @@ import JPopup from '/@/components/Form/src/jeecg/components/JPopup.vue';
import {getValueType} from '/@/utils';
import {saveOrUpdate, getProjectlevel} from '../AnnualCompPoint.api';
import {Form} from 'ant-design-vue';
+import { JVxeTable } from '/@/components/jeecg/JVxeTable';
+import { JVxeTypes, JVxeColumn} from '/@/components/jeecg/JVxeTable/types';
+const dataSource = ref([])
+const columns = ref([
+ {
+ title: '单行文本',
+ key: 'input',
+ type: JVxeTypes.input,
+ width: 180,
+ defaultValue: '',
+ placeholder: '请输入${title}',
+ validateRules: [
+ {
+ required: true, // 必填
+ message: '请输入${title}', // 显示的文本
+ },
+ {
+ pattern: /^[a-z|A-Z][a-z|A-Z\d_-]*$/, // 正则
+ message: '必须以字母开头,可包含数字、下划线、横杠',
+ },
+ {
+ unique: true,
+ message: '${title}不能重复',
+ },
+ {
+ handler({ cellValue, row, column }, callback, target) {
+ // cellValue 当前校验的值
+ // callback(flag, message) 方法必须执行且只能执行一次
+ // flag = 是否通过了校验,不填写或者填写 null 代表不进行任何操作
+ // message = 提示的类型,默认使用配置的 message
+ // target 行编辑的实例对象
+ if (cellValue === 'abc') {
+ callback(false, '${title}不能是abc') // false = 未通过校验
+ } else {
+ callback(true) // true = 通过验证
+ }
+ },
+ message: '${title}默认提示',
+ },
+ ],
+ },
+])
+function handleTableSave({ $table, target }) {
+ // 校验整个表格
+ $table.validate().then((errMap) => {
+ // 校验通过
+ if (!errMap) {
+ // 获取所有数据
+ let tableData = target.getTableData();
+ console.log('当前保存的数据是:', tableData);
+ // 获取新增的数据
+ let newData = target.getNewData();
+ console.log('-- 新增的数据:', newData);
+ // 获取删除的数据
+ let deleteData = target.getDeleteData();
+ console.log('-- 删除的数据:', deleteData);
+ // 【模拟保存】
+ loading.value = true;
+ defHttp
+ .post({
+ url: Api.saveAll,
+ params: tableData,
+ })
+ .then(() => {
+ createMessage.success(`保存成功!`);
+ })
+ .finally(() => {
+ loading.value = false;
+ });
+ }
+ });
+}
const props = defineProps({
// objLevelll: { type: Array, default: () => [] },
formDisabled: {type: Boolean, default: false},