改进:图片输入组件,根据输入的url获取的文件名
This commit is contained in:
parent
65aa2f7605
commit
b2f44877a5
@ -103,7 +103,7 @@ export default {
|
|||||||
fileList: [],
|
fileList: [],
|
||||||
isLocked: false, // true表示输入框正在输入状态
|
isLocked: false, // true表示输入框正在输入状态
|
||||||
timer: null,
|
timer: null,
|
||||||
uploadState: 0, // 文件上传状态, 0 没有文件上传, 1 正在上传, 2 上传成功
|
uploadState: 0, // 文件上传状态, 0 没有文件上传, 1 正在上传, 2 上传成功, 3 不支持自动上传, 4 加载中
|
||||||
uploadTip: '',
|
uploadTip: '',
|
||||||
dialogSelectFile: false,
|
dialogSelectFile: false,
|
||||||
uploadPercentage: 0
|
uploadPercentage: 0
|
||||||
@ -187,11 +187,17 @@ export default {
|
|||||||
that.uploadState = 4
|
that.uploadState = 4
|
||||||
that.urlToBlob(that.currentValue, response => {
|
that.urlToBlob(that.currentValue, response => {
|
||||||
that.uploadState = 1
|
that.uploadState = 1
|
||||||
|
let fileName = that.getFileNameByUrl(that.currentValue)
|
||||||
|
if (response.type.startsWith("image") && fileName.indexOf(".")) {
|
||||||
|
let suffix = response.type.replace("image/",".")
|
||||||
|
fileName += suffix
|
||||||
|
}
|
||||||
const file = new window.File(
|
const file = new window.File(
|
||||||
[response],
|
[response],
|
||||||
that.getFileNameByUrl(that.currentValue),
|
fileName,
|
||||||
{ type: response.type }
|
{ type: response.type }
|
||||||
);
|
);
|
||||||
|
console.log(file)
|
||||||
let data = new FormData()
|
let data = new FormData()
|
||||||
data.append("files", file)
|
data.append("files", file)
|
||||||
data.append("username", that.$store.state.user.name)
|
data.append("username", that.$store.state.user.name)
|
||||||
|
|||||||
@ -6,9 +6,9 @@
|
|||||||
<el-form size="medium" class="search-form" ref="queryForm" label-width="77px" :model="queryCondition"
|
<el-form size="medium" class="search-form" ref="queryForm" label-width="77px" :model="queryCondition"
|
||||||
@submit.native.prevent>
|
@submit.native.prevent>
|
||||||
<el-row :gutter="10">
|
<el-row :gutter="10">
|
||||||
<el-col :sm="12" :md="5">
|
<el-col v-if="!isLoginType" :sm="12" :md="isLoginType ? 8 : 4">
|
||||||
<el-form-item label="日志类型:">
|
<el-form-item label="日志类型:">
|
||||||
<el-select v-model="typeValue" placeholder="请选择日志类型" @change="selectType">
|
<el-select v-model="typeValue" style="width: 100%" :disabled="isLoginType" placeholder="请选择日志类型" @change="selectType">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@ -19,12 +19,17 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :sm="12" :md="6">
|
<el-col :sm="12" :md="isLoginType ? 8 : 5">
|
||||||
<el-form-item label="账号:">
|
<el-form-item label="账号:">
|
||||||
<el-input clearable placeholder="请输入" v-model="queryCondition.username"/>
|
<el-input clearable placeholder="请输入" v-model="queryCondition.username"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :sm="12" :md="6">
|
<el-col v-if="!isLoginType" :sm="12" :md="isLoginType ? 8 : 5">
|
||||||
|
<el-form-item label="操作模块:">
|
||||||
|
<el-input clearable placeholder="请输入" v-model="queryCondition.operationModule"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :sm="12" :md="isLoginType ? 8 : 5">
|
||||||
<el-form-item label="时间:" prop="logTime">
|
<el-form-item label="时间:" prop="logTime">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="pickerValue"
|
v-model="pickerValue"
|
||||||
@ -38,7 +43,7 @@
|
|||||||
</el-date-picker>
|
</el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :sm="12" :md="6">
|
<el-col :sm="12" :md="isLoginType ? 8 : 5">
|
||||||
<div class="el-form-actions">
|
<div class="el-form-actions">
|
||||||
<el-button class="card-btn-icon" size="medium" icon="el-icon-search" type="primary"
|
<el-button class="card-btn-icon" size="medium" icon="el-icon-search" type="primary"
|
||||||
@click="getLogList()">查询
|
@click="getLogList()">查询
|
||||||
@ -93,10 +98,7 @@ export default {
|
|||||||
pageSize: 12,
|
pageSize: 12,
|
||||||
pageTotal: 0
|
pageTotal: 0
|
||||||
},
|
},
|
||||||
options: this.type === 'LOGIN' ? [{
|
options: [{
|
||||||
value: 'LOGIN',
|
|
||||||
label: '登录'
|
|
||||||
}] : [{
|
|
||||||
value: 'LOGIN',
|
value: 'LOGIN',
|
||||||
label: '登录'
|
label: '登录'
|
||||||
}, {
|
}, {
|
||||||
@ -110,9 +112,11 @@ export default {
|
|||||||
label: 'WebDAV'
|
label: 'WebDAV'
|
||||||
}],
|
}],
|
||||||
typeValue: this.type,
|
typeValue: this.type,
|
||||||
|
isLoginType: this.type === 'LOGIN',
|
||||||
// 查询条件
|
// 查询条件
|
||||||
queryCondition: {
|
queryCondition: {
|
||||||
username: undefined,
|
username: undefined,
|
||||||
|
operationModule: undefined,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
startTime: undefined,
|
startTime: undefined,
|
||||||
endTime: undefined
|
endTime: undefined
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user