From 9b4433fddf5b401edb0aace8a404ac733b122702 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期四, 03 四月 2025 14:35:02 +0800
Subject: [PATCH] 添加非密字段显示

---
 Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/sword/view.js.vm |   77 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 77 insertions(+), 0 deletions(-)

diff --git a/Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/sword/view.js.vm b/Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/sword/view.js.vm
new file mode 100644
index 0000000..397b23e
--- /dev/null
+++ b/Source/BladeX-Tool/blade-starter-develop/src/main/resources/templates/sword/view.js.vm
@@ -0,0 +1,77 @@
+#set($upperEntityPath=$table.entityPath.toUpperCase())
+#set($editId="$" + "{" + "id" + "}")
+import React, { PureComponent } from 'react';
+import router from 'umi/router';
+import { Form, Card, Button } from 'antd';
+import { connect } from 'dva';
+import Panel from '../../../components/Panel';
+import styles from '../../../layouts/Sword.less';
+import { $!{upperEntityPath}_DETAIL } from '../../../actions/$!{table.entityPath}';
+
+const FormItem = Form.Item;
+
+@connect(({ $!{table.entityPath} }) => ({
+  $!{table.entityPath},
+}))
+@Form.create()
+class $!{entity}View extends PureComponent {
+  componentWillMount() {
+    const {
+      dispatch,
+      match: {
+        params: { id },
+      },
+    } = this.props;
+    dispatch($!{upperEntityPath}_DETAIL(id));
+  }
+
+  handleEdit = () => {
+    const {
+      match: {
+        params: { id },
+      },
+    } = this.props;
+    router.push(`/$!{servicePackage}/$!{table.entityPath}/edit/$!{editId}`);
+  };
+
+  render() {
+    const {
+      $!{table.entityPath}: { detail },
+    } = this.props;
+
+    const formItemLayout = {
+      labelCol: {
+        xs: { span: 24 },
+        sm: { span: 7 },
+      },
+      wrapperCol: {
+        xs: { span: 24 },
+        sm: { span: 12 },
+        md: { span: 10 },
+      },
+    };
+
+    const action = (
+      <Button type="primary" onClick={this.handleEdit}>
+        淇敼
+      </Button>
+    );
+
+    return (
+      <Panel title="鏌ョ湅" back="/$!{servicePackage}/$!{table.entityPath}" action={action}>
+        <Form hideRequiredMark style={{ marginTop: 8 }}>
+          <Card className={styles.card} bordered={false}>
+#foreach($field in $!{table.fields})
+#if($!{field.name}!=$!{tenantColumn})
+            <FormItem {...formItemLayout} label="$!{field.comment}">
+              <span>{detail.$!{field.propertyName}}</span>
+            </FormItem>
+#end
+#end
+          </Card>
+        </Form>
+      </Panel>
+    );
+  }
+}
+export default $!{entity}View;

--
Gitblit v1.9.3