|
@@ -28,11 +28,7 @@
|
|
|
:disabled="!pageScopedDisabled"
|
|
:disabled="!pageScopedDisabled"
|
|
|
/>
|
|
/>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
|
|
- label="Banner图片: "
|
|
|
|
|
- prop="bannerUrl"
|
|
|
|
|
- v-if="ruleForm.messageType === MessageTypeEnum.BANNER"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-form-item label="Banner图片: " prop="bannerUrl" v-if="ruleForm.messageType === MessageTypeEnum.BANNER">
|
|
|
<el-upload
|
|
<el-upload
|
|
|
ref="upload"
|
|
ref="upload"
|
|
|
v-model:file-list="fileList"
|
|
v-model:file-list="fileList"
|
|
@@ -81,6 +77,7 @@
|
|
|
:userGroupList="ruleForm.userGroupList"
|
|
:userGroupList="ruleForm.userGroupList"
|
|
|
:customUserList="ruleForm.customUserList"
|
|
:customUserList="ruleForm.customUserList"
|
|
|
:disabled="!pageScopedDisabled"
|
|
:disabled="!pageScopedDisabled"
|
|
|
|
|
+ :has-all="true"
|
|
|
/>
|
|
/>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
</CardLayout>
|
|
</CardLayout>
|
|
@@ -90,9 +87,17 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import { ref, watch, computed, unref } from 'vue'
|
|
|
|
|
- import { useRoute } from 'vue-router'
|
|
|
|
|
- import type { FormInstance, FormProps, FormRules, UploadProps, UploadUserFile, UploadInstance, UploadRawFile } from 'element-plus';
|
|
|
|
|
|
|
+ import { ref, watch, computed, unref } from 'vue';
|
|
|
|
|
+ import { useRoute } from 'vue-router';
|
|
|
|
|
+ import type {
|
|
|
|
|
+ FormInstance,
|
|
|
|
|
+ FormProps,
|
|
|
|
|
+ FormRules,
|
|
|
|
|
+ UploadProps,
|
|
|
|
|
+ UploadUserFile,
|
|
|
|
|
+ UploadInstance,
|
|
|
|
|
+ UploadRawFile,
|
|
|
|
|
+ } from 'element-plus';
|
|
|
import { ElMessage, genFileId } from 'element-plus';
|
|
import { ElMessage, genFileId } from 'element-plus';
|
|
|
import { Plus } from '@element-plus/icons-vue';
|
|
import { Plus } from '@element-plus/icons-vue';
|
|
|
import PushObject from '../../components/PushObject.vue';
|
|
import PushObject from '../../components/PushObject.vue';
|
|
@@ -110,8 +115,8 @@ import { ref, watch, computed, unref } from 'vue'
|
|
|
isDisabled: boolean;
|
|
isDisabled: boolean;
|
|
|
}
|
|
}
|
|
|
const props = defineProps<Props>();
|
|
const props = defineProps<Props>();
|
|
|
- const route = useRoute();
|
|
|
|
|
- const pageScopedDisabled = computed(() => props.isDisabled === false || route.query.viewModel === 'edit')
|
|
|
|
|
|
|
+ const route = useRoute();
|
|
|
|
|
+ const pageScopedDisabled = computed(() => props.isDisabled === false || route.query.viewModel === 'edit');
|
|
|
const labelPosition = ref<FormProps['labelPosition']>('left');
|
|
const labelPosition = ref<FormProps['labelPosition']>('left');
|
|
|
const childFromRef = ref<InstanceType<typeof PushObject>>();
|
|
const childFromRef = ref<InstanceType<typeof PushObject>>();
|
|
|
const actionUrl = computed(() => {
|
|
const actionUrl = computed(() => {
|
|
@@ -121,10 +126,7 @@ import { ref, watch, computed, unref } from 'vue'
|
|
|
/**
|
|
/**
|
|
|
* 表单相关操作
|
|
* 表单相关操作
|
|
|
*/
|
|
*/
|
|
|
- type Rule = Omit<
|
|
|
|
|
- RuleFormView,
|
|
|
|
|
- 'introduction' | 'contentType' | 'content' | 'contentUrl' | 'operator'
|
|
|
|
|
- >;
|
|
|
|
|
|
|
+ type Rule = Omit<RuleFormView, 'introduction' | 'contentType' | 'content' | 'contentUrl' | 'operator'>;
|
|
|
const formRules: FormRules<Rule> = {
|
|
const formRules: FormRules<Rule> = {
|
|
|
messageType: [{ required: true, trigger: 'change', message: '请选择消息样式' }],
|
|
messageType: [{ required: true, trigger: 'change', message: '请选择消息样式' }],
|
|
|
title: [{ required: true, trigger: 'change', message: '请输入消息标题' }],
|
|
title: [{ required: true, trigger: 'change', message: '请输入消息标题' }],
|
|
@@ -153,9 +155,9 @@ import { ref, watch, computed, unref } from 'vue'
|
|
|
fileList.value = [
|
|
fileList.value = [
|
|
|
{
|
|
{
|
|
|
name: '',
|
|
name: '',
|
|
|
- url: value.bannerUrl
|
|
|
|
|
|
|
+ url: value.bannerUrl,
|
|
|
},
|
|
},
|
|
|
- ]
|
|
|
|
|
|
|
+ ];
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -178,12 +180,9 @@ import { ref, watch, computed, unref } from 'vue'
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-
|
|
|
|
|
const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
|
|
const handleAvatarSuccess: UploadProps['onSuccess'] = (response) => {
|
|
|
// 注意,这里 response 是 没有被拦截处理
|
|
// 注意,这里 response 是 没有被拦截处理
|
|
|
ruleForm.value.bannerUrl = response.data.url;
|
|
ruleForm.value.bannerUrl = response.data.url;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 上传前限制
|
|
// 上传前限制
|
|
@@ -199,20 +198,20 @@ import { ref, watch, computed, unref } from 'vue'
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// 图片预览
|
|
// 图片预览
|
|
|
- const dialogImageUrl = ref('')
|
|
|
|
|
- const dialogVisible = ref(false)
|
|
|
|
|
|
|
+ const dialogImageUrl = ref('');
|
|
|
|
|
+ const dialogVisible = ref(false);
|
|
|
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
|
const handlePictureCardPreview: UploadProps['onPreview'] = (uploadFile) => {
|
|
|
- dialogImageUrl.value = uploadFile.url!
|
|
|
|
|
- dialogVisible.value = true
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ dialogImageUrl.value = uploadFile.url!;
|
|
|
|
|
+ dialogVisible.value = true;
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- const upload = ref<UploadInstance>()
|
|
|
|
|
|
|
+ const upload = ref<UploadInstance>();
|
|
|
const handleExceed: UploadProps['onExceed'] = (files) => {
|
|
const handleExceed: UploadProps['onExceed'] = (files) => {
|
|
|
- upload.value!.clearFiles()
|
|
|
|
|
- const file = files[0] as UploadRawFile
|
|
|
|
|
- file.uid = genFileId()
|
|
|
|
|
- upload.value!.handleStart(file)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ upload.value!.clearFiles();
|
|
|
|
|
+ const file = files[0] as UploadRawFile;
|
|
|
|
|
+ file.uid = genFileId();
|
|
|
|
|
+ upload.value!.handleStart(file);
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
const buildFromData = () => {
|
|
const buildFromData = () => {
|
|
|
const childValue = childFromRef.value!.getChildValue();
|
|
const childValue = childFromRef.value!.getChildValue();
|
|
@@ -230,8 +229,8 @@ import { ref, watch, computed, unref } from 'vue'
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const disabledDate = (time: Date) => {
|
|
const disabledDate = (time: Date) => {
|
|
|
- return time.getTime() < Date.now()
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ return time.getTime() < Date.now();
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
defineExpose({ validate, buildFromData });
|
|
defineExpose({ validate, buildFromData });
|
|
|
</script>
|
|
</script>
|