Browse Source

代码模板,表单查看功能

CzRger 9 months ago
parent
commit
202f7c274e

+ 75 - 72
snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/detail.vue.btl

@@ -10,82 +10,82 @@
 		>
 			<template #extra>
 				<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
-				<a-popconfirm title="请确认是否保存?" @confirm="onSubmit">
+				<a-popconfirm title="请确认是否保存?" @confirm="onSubmit" v-if="!isView">
                     <a-button type="primary" :loading="submitLoading">保存</a-button>
                 </a-popconfirm>
 			</template>
 		</a-page-header>
 		<a-form ref="formRef" :model="formData" :rules="formRules" layout="${formLayout}">
-        		<% if(gridWhether) { %>
-        			<a-row :gutter="16">
-        			<% for(var i = 0; i < configList.~size; i++) { %>
-        			<% if(!configList[i].needTableId && configList[i].whetherAddUpdate) { %>
-        				<a-col :span="12">
-        					<a-form-item label="${configList[i].fieldRemark}:" name="${configList[i].fieldNameCamelCase}">
-        						<% if(configList[i].effectType == 'input') { %>
-        						<a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
-        						<% } else if (configList[i].effectType == 'textarea') {%>
-        						<a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
-        						<% } else if (configList[i].effectType == 'select') {%>
-        						<a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
-        						<% } else if (configList[i].effectType == 'radio') {%>
-        						<a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
-        						<% } else if (configList[i].effectType == 'checkbox') {%>
-        						<a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
-        						<% } else if (configList[i].effectType == 'datepicker') {%>
-        						<a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
-        						<% } else if (configList[i].effectType == 'timepicker') {%>
-        						<a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
-        						<% } else if (configList[i].effectType == 'inputNumber') {%>
-        						<a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" :min="1" :max="10000" style="width: 100%" />
-        						<% } else if (configList[i].effectType == 'slider') {%>
-        						<a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" :max="1000" style="width: 100%" />
-        						<% } else if (configList[i].effectType == 'fileUpload') {%>
-        						<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" />
-        						<% } else if (configList[i].effectType == 'imageUpload') {%>
-        						<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" uploadMode="image" />
-        						<% } else if (configList[i].effectType == 'editor') {%>
-        						<xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" />
-        						<% } %>
-        					</a-form-item>
-        				</a-col>
-        			<% } %>
-        			<% } %>
-        			</a-row>
-        		<% } else { %>
-        		<% for(var i = 0; i < configList.~size; i++) { %>
-        		<% if(!configList[i].needTableId && configList[i].whetherAddUpdate) { %>
-        			<a-form-item label="${configList[i].fieldRemark}:" name="${configList[i].fieldNameCamelCase}">
-        				<% if(configList[i].effectType == 'input') { %>
-        				<a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
-        				<% } else if (configList[i].effectType == 'textarea') {%>
-        				<a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
-        				<% } else if (configList[i].effectType == 'select') {%>
-        				<a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
-        				<% } else if (configList[i].effectType == 'radio') {%>
-        				<a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
-        				<% } else if (configList[i].effectType == 'checkbox') {%>
-        				<a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
-        				<% } else if (configList[i].effectType == 'datepicker') {%>
-        				<a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
-        				<% } else if (configList[i].effectType == 'timepicker') {%>
-        				<a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
-        				<% } else if (configList[i].effectType == 'inputNumber') {%>
-        				<a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" :min="1" :max="10000" style="width: 100%" />
-        				<% } else if (configList[i].effectType == 'slider') {%>
-        				<a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请滑动${configList[i].fieldRemark}" :max="1000" style="width: 100%" />
-        				<% } else if (configList[i].effectType == 'fileUpload') {%>
-        				<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" />
-        				<% } else if (configList[i].effectType == 'imageUpload') {%>
-        				<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" uploadMode="image" />
-        				<% } else if (configList[i].effectType == 'editor') {%>
-        				<xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" />
-        				<% } %>
-        			</a-form-item>
-        		<% } %>
-        		<% } %>
-        		<% } %>
-        		</a-form>
+        <% if(gridWhether) { %>
+            <a-row :gutter="16">
+            <% for(var i = 0; i < configList.~size; i++) { %>
+            <% if(!configList[i].needTableId && configList[i].whetherAddUpdate) { %>
+                <a-col :span="12">
+                    <a-form-item label="${configList[i].fieldRemark}:" name="${configList[i].fieldNameCamelCase}">
+                        <% if(configList[i].effectType == 'input') { %>
+                        <a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
+                        <% } else if (configList[i].effectType == 'textarea') {%>
+                        <a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
+                        <% } else if (configList[i].effectType == 'select') {%>
+                        <a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+                        <% } else if (configList[i].effectType == 'radio') {%>
+                        <a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+                        <% } else if (configList[i].effectType == 'checkbox') {%>
+                        <a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+                        <% } else if (configList[i].effectType == 'datepicker') {%>
+                        <a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+                        <% } else if (configList[i].effectType == 'timepicker') {%>
+                        <a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+                        <% } else if (configList[i].effectType == 'inputNumber') {%>
+                        <a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" :min="1" :max="10000" style="width: 100%" />
+                        <% } else if (configList[i].effectType == 'slider') {%>
+                        <a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" :max="1000" style="width: 100%" />
+                        <% } else if (configList[i].effectType == 'fileUpload') {%>
+                        <xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" />
+                        <% } else if (configList[i].effectType == 'imageUpload') {%>
+                        <xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" uploadMode="image" />
+                        <% } else if (configList[i].effectType == 'editor') {%>
+                        <xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" />
+                        <% } %>
+                    </a-form-item>
+                </a-col>
+            <% } %>
+            <% } %>
+            </a-row>
+        <% } else { %>
+        <% for(var i = 0; i < configList.~size; i++) { %>
+        <% if(!configList[i].needTableId && configList[i].whetherAddUpdate) { %>
+            <a-form-item label="${configList[i].fieldRemark}:" name="${configList[i].fieldNameCamelCase}">
+                <% if(configList[i].effectType == 'input') { %>
+                <a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
+                <% } else if (configList[i].effectType == 'textarea') {%>
+                <a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
+                <% } else if (configList[i].effectType == 'select') {%>
+                <a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+                <% } else if (configList[i].effectType == 'radio') {%>
+                <a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+                <% } else if (configList[i].effectType == 'checkbox') {%>
+                <a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+                <% } else if (configList[i].effectType == 'datepicker') {%>
+                <a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+                <% } else if (configList[i].effectType == 'timepicker') {%>
+                <a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+                <% } else if (configList[i].effectType == 'inputNumber') {%>
+                <a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" :min="1" :max="10000" style="width: 100%" />
+                <% } else if (configList[i].effectType == 'slider') {%>
+                <a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请滑动${configList[i].fieldRemark}" :max="1000" style="width: 100%" />
+                <% } else if (configList[i].effectType == 'fileUpload') {%>
+                <xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" />
+                <% } else if (configList[i].effectType == 'imageUpload') {%>
+                <xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" uploadMode="image" />
+                <% } else if (configList[i].effectType == 'editor') {%>
+                <xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" />
+                <% } %>
+            </a-form-item>
+        <% } %>
+        <% } %>
+        <% } %>
+        </a-form>
 	</a-card>
 </template>
 
@@ -112,6 +112,7 @@
 	// 表单数据
 	const formData = ref({})
 	const submitLoading = ref(false)
+	const isView = ref(false)
 	<% for(var i = 0; i < configList.~size; i++) { %>
 	<% if(!configList[i].needTableId) { %>
 	<% if(configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %>
@@ -121,7 +122,8 @@
 	<% } %>
 
 	// 打开抽屉
-	const onOpen = (record) => {
+	const onOpen = (record, view = false) => {
+	    isView.value = view
 		if (record) {
 			let recordData = cloneDeep(record)
 			<% for(var i = 0; i < configList.~size; i++) { %>
@@ -143,6 +145,7 @@
 	const onClose = () => {
 		formRef.value.resetFields()
 		formData.value = {}
+		isView.value = true
 		emit('onClose')
 	}
 	// 默认要校验的

+ 29 - 26
snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/form.vue.btl

@@ -18,29 +18,29 @@
 				<a-col :span="12">
 					<a-form-item label="${configList[i].fieldRemark}:" name="${configList[i].fieldNameCamelCase}">
 						<% if(configList[i].effectType == 'input') { %>
-						<a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
+						<a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
 						<% } else if (configList[i].effectType == 'textarea') {%>
-						<a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
+						<a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
 						<% } else if (configList[i].effectType == 'select') {%>
-						<a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+						<a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
 						<% } else if (configList[i].effectType == 'radio') {%>
-						<a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+						<a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
 						<% } else if (configList[i].effectType == 'checkbox') {%>
-						<a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+						<a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
 						<% } else if (configList[i].effectType == 'datepicker') {%>
-						<a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+						<a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
 						<% } else if (configList[i].effectType == 'timepicker') {%>
-						<a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+						<a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
 						<% } else if (configList[i].effectType == 'inputNumber') {%>
-						<a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" :min="1" :max="10000" style="width: 100%" />
+						<a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" :min="1" :max="10000" style="width: 100%" />
 						<% } else if (configList[i].effectType == 'slider') {%>
-						<a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" :max="1000" style="width: 100%" />
+						<a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" :max="1000" style="width: 100%" />
 						<% } else if (configList[i].effectType == 'fileUpload') {%>
-						<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" />
+						<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" />
 						<% } else if (configList[i].effectType == 'imageUpload') {%>
-						<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" uploadMode="image" />
+						<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" uploadMode="image" />
 						<% } else if (configList[i].effectType == 'editor') {%>
-						<xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" />
+						<xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" />
 						<% } %>
 					</a-form-item>
 				</a-col>
@@ -52,29 +52,29 @@
 		<% if(!configList[i].needTableId && configList[i].whetherAddUpdate) { %>
 			<a-form-item label="${configList[i].fieldRemark}:" name="${configList[i].fieldNameCamelCase}">
 				<% if(configList[i].effectType == 'input') { %>
-				<a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
+				<a-input v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" allow-clear />
 				<% } else if (configList[i].effectType == 'textarea') {%>
-				<a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
+				<a-textarea v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" :auto-size="{ minRows: 3, maxRows: 5 }" />
 				<% } else if (configList[i].effectType == 'select') {%>
-				<a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+				<a-select v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
 				<% } else if (configList[i].effectType == 'radio') {%>
-				<a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+				<a-radio-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
 				<% } else if (configList[i].effectType == 'checkbox') {%>
-				<a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
+				<a-checkbox-group v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请选择${configList[i].fieldRemark}" :options="${configList[i].fieldNameCamelCase}Options" />
 				<% } else if (configList[i].effectType == 'datepicker') {%>
-				<a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+				<a-date-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
 				<% } else if (configList[i].effectType == 'timepicker') {%>
-				<a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
+				<a-time-picker v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" value-format="YYYY-MM-DD HH:mm:ss" show-time placeholder="请选择${configList[i].fieldRemark}" style="width: 100%" />
 				<% } else if (configList[i].effectType == 'inputNumber') {%>
-				<a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" :min="1" :max="10000" style="width: 100%" />
+				<a-input-number v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" :min="1" :max="10000" style="width: 100%" />
 				<% } else if (configList[i].effectType == 'slider') {%>
-				<a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请滑动${configList[i].fieldRemark}" :max="1000" style="width: 100%" />
+				<a-slider v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请滑动${configList[i].fieldRemark}" :max="1000" style="width: 100%" />
 				<% } else if (configList[i].effectType == 'fileUpload') {%>
-				<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" />
+				<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" />
 				<% } else if (configList[i].effectType == 'imageUpload') {%>
-				<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" uploadMode="image" />
+				<xn-upload v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" uploadMode="image" />
 				<% } else if (configList[i].effectType == 'editor') {%>
-				<xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" placeholder="请输入${configList[i].fieldRemark}" />
+				<xn-editor v-model:value="formData.${configList[i].fieldNameCamelCase}" :disabled="isView" placeholder="请输入${configList[i].fieldRemark}" />
 				<% } %>
 			</a-form-item>
 		<% } %>
@@ -83,7 +83,7 @@
 		</a-form>
 		<template #footer>
 			<a-button style="margin-right: 8px" @click="onClose">关闭</a-button>
-			<a-popconfirm title="请确认是否保存?" @confirm="onSubmit">
+			<a-popconfirm title="请确认是否保存?" @confirm="onSubmit" v-if="!isView">
                 <a-button type="primary" :loading="submitLoading">保存</a-button>
             </a-popconfirm>
 		</template>
@@ -114,6 +114,7 @@
 	// 表单数据
 	const formData = ref({})
 	const submitLoading = ref(false)
+	const isView = ref(false)
 	<% for(var i = 0; i < configList.~size; i++) { %>
 	<% if(!configList[i].needTableId) { %>
 	<% if(configList[i].effectType == 'select' || configList[i].effectType == 'radio' || configList[i].effectType == 'checkbox') { %>
@@ -123,8 +124,9 @@
 	<% } %>
 
 	// 打开抽屉
-	const onOpen = (record) => {
+	const onOpen = (record, view = false) => {
 		open.value = true
+		isView.value = view
 		if (record) {
 			let recordData = cloneDeep(record)
 			<% for(var i = 0; i < configList.~size; i++) { %>
@@ -147,6 +149,7 @@
 		formRef.value.resetFields()
 		formData.value = {}
 		open.value = false
+		isView.value = true
 	}
 	// 默认要校验的
 	const formRules = {

+ 3 - 1
snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/index.vue.btl

@@ -133,6 +133,8 @@
 				<% } %>
 				<template v-if="column.dataIndex === 'action'">
 					<a-space>
+						<a @click="formRef.onOpen(record)" v-if="hasPerm('${classNameFirstLower}View')">查看</a>
+						<a-divider type="vertical" v-if="hasPerm('${classNameFirstLower}View') && hasPerm(['${classNameFirstLower}Edit', '${classNameFirstLower}Delete'], 'or')" />
 						<a @click="formRef.onOpen(record)" v-if="hasPerm('${classNameFirstLower}Edit')">编辑</a>
 						<a-divider type="vertical" v-if="hasPerm(['${classNameFirstLower}Edit', '${classNameFirstLower}Delete'], 'and')" />
 						<a-popconfirm title="确定要删除吗?" @confirm="delete${className}(record)">
@@ -208,7 +210,7 @@
 			title: '操作',
 			dataIndex: 'action',
 			align: 'center',
-			width: 150,
+			width: 200,
 			fixed: 'right',
 		})
 	}

+ 5 - 3
snowy-plugin/snowy-plugin-gen/src/main/resources/frontend/index_inside.vue.btl

@@ -133,6 +133,8 @@
 				<% } %>
 				<template v-if="column.dataIndex === 'action'">
 					<a-space>
+					    <a @click="onDetail(record, true)" v-if="hasPerm('${classNameFirstLower}View')">查看</a>
+                        <a-divider type="vertical" v-if="hasPerm('${classNameFirstLower}View') && hasPerm(['${classNameFirstLower}Edit', '${classNameFirstLower}Delete'], 'or')" />
 						<a @click="onDetail(record)" v-if="hasPerm('${classNameFirstLower}Edit')">编辑</a>
 						<a-divider type="vertical" v-if="hasPerm(['${classNameFirstLower}Edit', '${classNameFirstLower}Delete'], 'and')" />
 						<a-popconfirm title="确定要删除吗?" @confirm="delete${className}(record)">
@@ -209,7 +211,7 @@
 			title: '操作',
 			dataIndex: 'action',
 			align: 'center',
-			width: 150,
+			width: 200,
 			fixed: 'right',
 		})
 	}
@@ -302,11 +304,11 @@
         })
     }
 	// 切换至表单
-    const onDetail = (record = null) => {
+    const onDetail = (record = null, view) => {
     	indexShow.value = false
     	nextTick(() => {
     		if (record) {
-    			detailRef.value.onOpen(record)
+    			detailRef.value.onOpen(record, view)
     		}
     	})
     }