上传标签
<el-upload
drag
multiple
:limit="4"
:on-exceed="handleExceed"
:action="upload.url"
:show-file-list="false"
:headers="upload.headers"
:file-list="fileListTemplate"
:on-success="uploadSuccessTemplate">
// 上传限制方法
handleExceed(files, fileList) {
this.$message.warning(`当前限制选择 4 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length} 个文件`)
},
/**
*Template Upload 文件上传成功回调函数
*
* @param response 返回信息
* @param file 文件信息 + 返回信息
* @param fileList 文件信息数组
*/
uploadSuccessTemplate(response, file, fileListTemplate) {
// 文件对象
let fileObj = {
id: file.uid,
fileName: file.name,
description: '',
nasFileName: response.data.nasFileName
}
console.log(response.data.nasFileName)
// 文件大小
if (file.size < 1024) {
// B 字节
fileObj.size = file.size + 'B'
} else if (file.size < 1024 * 1024) {
// KB
fileObj.size = Math.round(file.size / 1024) + 'KB'
} else if (file.size < 1024 * 1024 * 1024) {
// MB
fileObj.size = (file.size / 1024 / 1024).toFixed(2) + 'MB'
}
// 时间
let date = new Date(file.uid)
// yyyy-MM-dd HH:mm:ss格式(补0)
fileObj.when = date.getFullYear() + '-'
+ ((date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : (date.getMonth() + 1)) + '-'
+ (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' '
+ (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':'
+ (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':'
+ (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds())
this.fileListTemplate.splice(0, 0, fileObj)
},
tooltip案例
<template slot-scope="scope" >
<div v-if="scope.row.content.length>8">
<el-tooltip class="item" effect="dark" :content="scope.row.content" placement="top-start">
<span>
{{handleTooltipLetter(scope.row.content)}}
</span>
</el-tooltip>
</div>
<div v-else>
<span > {{handleTooltipLetter(scope.row.content)}}</span>
</div>
</template>
注意:
对按钮进行隐藏时
1.选中多条数据时数据存放的字段为数组[]用
2.选中单条数据时数据存放的字段为对象{}用:disabled="null ==currentRow "
案例: currentRow为字段
<el-button :disabled="null ==currentRow " type="danger" @click="del()" plain
icon="el-icon-delete">删除
</el-button>
关闭页面方法
import store from '@/store'
import router from '@/router';
export default {
// 刷新当前tab页签
refreshPage(obj) {
const { path, query, matched } = router.currentRoute;
if (obj === undefined) {
matched.forEach((m) => {
if (m.components && m.components.default && m.components.default.name) {
if (!['Layout', 'ParentView'].includes(m.components.default.name)) {
obj = { name: m.components.default.name, path: path, query: query };
}
}
});
}
return store.dispatch('tagsView/delCachedView', obj).then(() => {
const { path, query } = obj
router.replace({
path: '/redirect' + path,
query: query
})
})
},
// 关闭当前tab页签,打开新页签
closeOpenPage(obj) {
store.dispatch("tagsView/delView", router.currentRoute);
if (obj !== undefined) {
return router.push(obj);
}
},
// 关闭指定tab页签
closePage(obj) {
if (obj === undefined) {
return store.dispatch('tagsView/delView', router.currentRoute).then(({ lastPath }) => {
return router.push(lastPath || '/');
});
}
return store.dispatch('tagsView/delView', obj);
},
// 关闭所有tab页签
closeAllPage() {
return store.dispatch('tagsView/delAllViews');
},
// 关闭左侧tab页签
closeLeftPage(obj) {
return store.dispatch('tagsView/delLeftTags', obj || router.currentRoute);
},
// 关闭右侧tab页签
closeRightPage(obj) {
return store.dispatch('tagsView/delRightTags', obj || router.currentRoute);
},
// 关闭其他tab页签
closeOtherPage(obj) {
return store.dispatch('tagsView/delOthersViews', obj || router.currentRoute);
},
// 添加tab页签
openPage(title, url) {
var obj = { path: url, meta: { title: title } }
store.dispatch('tagsView/addView', obj);
return router.push(url);
},
// 修改tab页签
updatePage(obj) {
return store.dispatch('tagsView/updateVisitedView', obj);
}
}
点击按钮添加一行输入框
<!-- 这里是一个列表 -->
<el-table-item>
<el-form>
<el-button @click="addDomain"
>Add
</el-button>
<el-table
:data="dynamicValidateForm.tableData" ref="dynamicValidateForm"
border
style="width: 100%">
<el-table-column
prop="fileName"
label="Business User"
width="320"
align="center">
</el-table-column>
<el-table-column
prop="name"
label="Name"
align="center"><el-input placeholder="Name"></el-input>
</el-table-column>
<el-table-column
prop="date"
label="Date"
width="320"
align="center">
<el-date-picker
type="date"
value-format="yyyy-MM-dd"
placeholder="Release Call Date"
style="width: 221.4px;">
</el-date-picker>
</el-table-column>
<el-table-column
prop="screenshot"
label="Screenshot"
width="320"
align="center">
<el-upload></el-upload>
</el-table-column>
<el-table-column
prop="operate"
label="操作"
width="320"
align="center">
<template slot-scope="{ row }">
<el-button type="danger" size="small" @click="deleteFile(row.id)">Delete</el-button>
</template>
</el-table-column>
</el-table>
</el-form>
</el-table-item>
//第四页add键增加user方法
addDomain() {
this.aaa = this.dynamicValidateForm.tableData.length+1;
if (this.aaa > 4) {
this.$confirm('最多上传4条数据')
return
}
this.dynamicValidateForm.tableData.push(
{fileName: "Business User"+this.aaa, name: "Name", date: "Date", screenshot: "Screenshot", operate: "操作",id:this.dynamicValidateForm.tableData.length+1}
)
//this.reload();
console.log(this.dynamicValidateForm.tableData)
},
Oracle回滚数据到某一时刻
create table T_INBOUND_COPY_20220708_3 as select * from T_INBOUND_COPY as of timestamp to_timestamp('2022-07-08 11:18:00','YYYY-MM-DD hh24:mi:ss') where 1=1
查询字段数据是否存在重复
SELECT SERIALNUMBER(字段的值) FROM "MPC_DDI_INVENTORY" where (条件)DATELASTUPDATED = to_date('2022-07-25 20:33:25', 'YYYY-MM_DD HH24:MI:SS') group by (要查的字段)SERIALNUMBER HAVING count(SERIALNUMBER) > 1