diff --git a/src/components/AIcon/index.tsx b/src/components/AIcon/index.tsx
index 02e6d8a2..604aa3fe 100644
--- a/src/components/AIcon/index.tsx
+++ b/src/components/AIcon/index.tsx
@@ -26,7 +26,8 @@ const iconKeys = [
'ExportOutlined',
'SyncOutlined',
'ExclamationCircleOutlined',
- 'UploadOutlined'
+ 'UploadOutlined',
+ 'QuestionCircleOutlined'
]
const Icon = (props: {type: string}) => {
diff --git a/src/views/notice/Template/Detail/components/VariableDefinitions.vue b/src/views/notice/Template/Detail/components/VariableDefinitions.vue
new file mode 100644
index 00000000..249fe830
--- /dev/null
+++ b/src/views/notice/Template/Detail/components/VariableDefinitions.vue
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+ {{ record[column.dataIndex] }}
+
+
+
+ 字符串
+ 时间
+ 数字
+
+
+
+ {{ record.format }}
+
+
+
+ timestamp
+
+
+ yyyy-MM-dd
+
+
+ yyyy-MM-dd HH:mm:ss
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/views/notice/Template/Detail/index.vue b/src/views/notice/Template/Detail/index.vue
index 9699ee50..610ad87d 100644
--- a/src/views/notice/Template/Detail/index.vue
+++ b/src/views/notice/Template/Detail/index.vue
@@ -418,6 +418,34 @@
+
+
+
+
+
+
formData.value.template.message,
+ (val) => {
+ if (!val) return;
+ // 已经存在的变量
+ const oldKey = formData.value.variableDefinitions?.map((m) => m.id);
+ // 正则提取${}里面的值
+ const pattern = /(?<=\$\{).*?(?=\})/g;
+ const titleList = val.match(pattern)?.filter((f) => f);
+ const newKey = [...new Set(titleList)];
+ const result = newKey?.map((m) =>
+ oldKey.includes(m)
+ ? formData.value.variableDefinitions.find(
+ (item) => item.id === m,
+ )
+ : {
+ id: m,
+ name: '',
+ type: 'string',
+ format: '%s',
+ },
+ );
+ formData.value.variableDefinitions = result;
+ },
+ { deep: true },
+);
+
const getDetail = async () => {
const res = await templateApi.detail(route.params.id as string);
// console.log('res: ', res);
@@ -589,9 +645,9 @@ const handleSubmit = () => {
// test
watch(
- () => formData.value.template,
+ () => formData.value,
(val) => {
- console.log('formData.value.template: ', val);
+ console.log('formData.value: ', val);
},
{ deep: true },
);