|
@@ -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')
|
|
|
}
|
|
|
// 默认要校验的
|