1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| <html> <head></head> <body> <template> <el-form size="small" :model="form" :rules="rules" ref="form" label-width="120px"> <div class="head_main"> <el-row :gutter="24"> <el-col :span="20"> <div class="key_tip"> 【关于文件清理的说明】 <p style="color: red;">本页面功能主要是删除本地指定日期段及指定路径下的所有文件</p> <p style="color: green;">☞指定路径:本地文件夹的绝对路径</p> <p style="color: green;">☞指定日期段:本地文件夹下的文件的最新修改日期</p> </div> </el-col> </el-row> <el-row :gutter="24"> <el-col :span="12"> <el-form-item label="指定路径:" prop="filePath"> <el-input class="entity" type="textarea" clearable="" placeholder="请输入指定路径" v-model="form.filePath"> </el-input> </el-form-item> </el-col> </el-row> <el-row :gutter="24"> <el-col :span="12"> <el-form-item label="指定日期段:" prop="operationTime"> <el-date-picker class="entity" v-model="operationTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" clearable="" size="small" style="width:100%"> </el-date-picker> </el-form-item> </el-col> </el-row> <el-row :gutter="15"> <el-col :span="24"> <el-form-item> <el-button type="primary" des="el" @click="cleanUp"> 清理 </el-button> <el-button des="el" @click="reset"> 重置 </el-button> </el-form-item> </el-col> </el-row> </div> </el-form> </template> <script> import { 方法名 } from '方法名所在JS文件' export default { data () { return { form: { filePath: '', operationTime: '', }, rules: { filePath: [ { required: true, message: '请输入指定路径', trigger: 'blur' }, ], }, } }, created () { }, methods: { cleanUp () { this.$refs.form.validate(async (valid) => { if (!valid) return let startTime, endTime if (this.operationTime) { startTime = this.operationTime[0] endTime = this.operationTime[1] } try { await DeleteSpecifiedPathAllFile({ FilePath: this.form.filePath, StartTime: startTime, EndTime: endTime, }) this.$notify({ type: 'success', offset: 50, title: '当前文件修改日期段的指定路径下的所有文件删除成功', }) return } catch (error) { console.log('error:', error) } }) }, reset () { this.form.filePath = '' this.operationTime = '' }, }, } </script> <style lang="scss"> .head_main { .key_tip { box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04); padding: 8px 16px; background-color: #ecf8ff; border-radius: 4px; border-left: 5px solid #50bfff; margin: 20px 0; line-height: 22px; } } </style> </body> </html>
|