Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
111047e788
@ -1,245 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import { applicationAdd } from '@/api/application/application'
|
|
||||||
import { ElMessage } from 'element-plus-secondary'
|
|
||||||
// import type { UploadProps } from 'element-plus'
|
|
||||||
const emit = defineEmits(['closeClick'])
|
|
||||||
const { t } = useI18n()
|
|
||||||
const isDialog:any = ref(true)
|
|
||||||
const isSwitch:any = ref(false)
|
|
||||||
// const props = defineProps({
|
|
||||||
// dialogEditParams: {
|
|
||||||
// type: Boolean,
|
|
||||||
// default: false
|
|
||||||
// },
|
|
||||||
// paramsObj: {
|
|
||||||
// type: Object,
|
|
||||||
// default: () => {
|
|
||||||
// return {
|
|
||||||
// name: '',
|
|
||||||
// deType: 0
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// paramsObjRules: {
|
|
||||||
// type: Object,
|
|
||||||
// default: () => {
|
|
||||||
// return {
|
|
||||||
// name: []
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
const dataInfo:any = ref({
|
|
||||||
type: '01',
|
|
||||||
name: '',
|
|
||||||
description: '',
|
|
||||||
image: ''
|
|
||||||
})
|
|
||||||
const paramsObjRules = ref(
|
|
||||||
{
|
|
||||||
// name: [
|
|
||||||
// {
|
|
||||||
// required: true,
|
|
||||||
// message: "",
|
|
||||||
// trigger: 'change'
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
})
|
|
||||||
function paramsResetForm() {
|
|
||||||
emit('closeClick', false)
|
|
||||||
}
|
|
||||||
function saveParamsObj(){
|
|
||||||
|
|
||||||
if(isSwitch.value == true){
|
|
||||||
return
|
|
||||||
}
|
|
||||||
isSwitch.value = true
|
|
||||||
applicationAdd(dataInfo.value).then(res => {
|
|
||||||
ElMessage.success('添加成功')
|
|
||||||
emit('closeClick', false)
|
|
||||||
}).catch(() => {
|
|
||||||
isSwitch.value = false
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
const handleAvatarSuccess = file => {
|
|
||||||
// if (file.raw!.type !== 'image/jpeg'&& file.raw!.type !== 'image/png') {
|
|
||||||
// // ElMessage.error('Avatar picture must be JPG format!')
|
|
||||||
// return false
|
|
||||||
// } else if (file.size / 1024 / 1024 > 2) {
|
|
||||||
// // ElMessage.error('Avatar picture size can not exceed 2MB!')
|
|
||||||
// return false
|
|
||||||
// }
|
|
||||||
const reader = new FileReader()
|
|
||||||
reader.onload = (e) => {
|
|
||||||
dataInfo.value.image = e.target.result // 这里会得到 base64 字符串
|
|
||||||
}
|
|
||||||
reader.readAsDataURL(file.raw) // 读取文件内容为 Data URL
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<template>
|
|
||||||
<el-dialog
|
|
||||||
:title="'新建空白项目'"
|
|
||||||
v-model="isDialog"
|
|
||||||
width="570px"
|
|
||||||
class="create-project-dialog"
|
|
||||||
:before-close="paramsResetForm"
|
|
||||||
>
|
|
||||||
<el-form
|
|
||||||
ref="paramsObjRef"
|
|
||||||
:model="dataInfo"
|
|
||||||
:rules="paramsObjRules"
|
|
||||||
>
|
|
||||||
<el-form-item :label="'项目名称'" prop="name">
|
|
||||||
<el-input
|
|
||||||
:placeholder="'请输入'"
|
|
||||||
v-model="dataInfo.name"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="'项目描述'" prop="name">
|
|
||||||
<el-input
|
|
||||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
|
||||||
type="textarea"
|
|
||||||
:placeholder="'请输入'"
|
|
||||||
v-model="dataInfo.description"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label="'上传logo'" prop="name">
|
|
||||||
<el-upload
|
|
||||||
class="avatar-uploader"
|
|
||||||
action=""
|
|
||||||
:auto-upload="false"
|
|
||||||
accept=".jpeg,.jpg,.png,.gif,.svg"
|
|
||||||
:show-file-list="false"
|
|
||||||
:on-change="handleAvatarSuccess"
|
|
||||||
>
|
|
||||||
<img v-if="dataInfo.image != ''" :src="dataInfo.image" style="width: 223px;height: 120px;"/>
|
|
||||||
<div v-else class="update-avatar">
|
|
||||||
<img src="@/assets/newimg/u166.png" alt="">
|
|
||||||
<div class="update-avatar-text">点击上传图片</div>
|
|
||||||
</div>
|
|
||||||
<!-- <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> -->
|
|
||||||
</el-upload>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<template #footer>
|
|
||||||
<el-button secondary @click="paramsResetForm">{{ t('dataset.cancel') }} </el-button>
|
|
||||||
<el-button type="primary" @click="saveParamsObj">{{ t('dataset.confirm') }} </el-button>
|
|
||||||
</template>
|
|
||||||
</el-dialog>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style lang="less" scoped>
|
|
||||||
:deep(.ed-input__wrapper){
|
|
||||||
background-color: rgba(37, 38, 38, 1);
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: rgba(67, 67, 67,0);
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow:0 0 0 1px rgb(67, 67, 67) inset ;
|
|
||||||
}
|
|
||||||
:deep(.ed-input__wrapper:hover){
|
|
||||||
background-color: rgba(37, 38, 38, 1);
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: rgb(67, 67, 67);
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 0 0 1px #0089ff inset;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
:deep(.ed-input__inner){
|
|
||||||
background-color: rgba(37, 38, 38, 1);
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: rgba(51, 51, 51, 0);
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
:deep(.ed-input-group__prepend){
|
|
||||||
background-color: rgba(37, 38, 38, 1);
|
|
||||||
border: 0;
|
|
||||||
box-shadow:0 0 0 1px transparent ;
|
|
||||||
padding:0 10px;
|
|
||||||
padding-right: 0;
|
|
||||||
border-color: rgba(51, 51, 51, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
:deep(.ed-textarea__inner){
|
|
||||||
background-color: rgba(37, 38, 38, 1);
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: rgba(51, 51, 51, 0);
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #fff;
|
|
||||||
box-shadow: 0 0 0 1px rgb(67, 67, 67) inset;
|
|
||||||
}
|
|
||||||
:deep(.ed-textarea__inner:hover){
|
|
||||||
background-color: rgba(37, 38, 38, 1);
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: rgba(51, 51, 51, 0);
|
|
||||||
border-radius: 4px;
|
|
||||||
color: #fff;
|
|
||||||
box-shadow: 0 0 0 1px #0089ff inset;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.update-avatar{
|
|
||||||
width: 223px;
|
|
||||||
height: 120px;
|
|
||||||
background: inherit;
|
|
||||||
background-color: rgba(40, 40, 40, 1);
|
|
||||||
box-sizing: border-box;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: rgba(54, 54, 54, 1);
|
|
||||||
border-radius: 4px;
|
|
||||||
display: flex;
|
|
||||||
align-content: center;
|
|
||||||
justify-content: center;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
.update-avatar-text{
|
|
||||||
margin-top: 10px;
|
|
||||||
width: 100%;
|
|
||||||
font-family: 'Arial Normal', 'Arial';
|
|
||||||
font-weight: 400;
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #969696;
|
|
||||||
text-align: center;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
<style>
|
|
||||||
|
|
||||||
.create-project-dialog{
|
|
||||||
--ed-dialog-bg-color: rgba(33, 33, 33, 1);
|
|
||||||
}
|
|
||||||
.create-project-dialog .ed-dialog__title{
|
|
||||||
font-family: 'Arial Negreta', 'Arial Normal', 'Arial';
|
|
||||||
font-weight: 700;
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #F2F4F5;
|
|
||||||
}
|
|
||||||
.create-project-dialog .ed-form-item__label{
|
|
||||||
font-family: 'Arial Normal', 'Arial';
|
|
||||||
font-weight: 400;
|
|
||||||
font-style: normal;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #D2D2D2;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
Loading…
Reference in New Issue
Block a user