| | |
| | | :width="180" |
| | | trigger="click"> |
| | | <div class="center"> |
| | | <el-button type="primary" size="mini">查看文件</el-button> |
| | | <el-button type="primary" size="mini" @click="viewFolder">查看文件</el-button> |
| | | <el-button type="primary" size="mini" |
| | | v-if="$store.state.login.username == 'superuser'" |
| | | @click="updateParams.show=true">参数设置</el-button> |
| | | @click="editParams">参数设置</el-button> |
| | | </div> |
| | | <el-button slot="reference" type="success" size="mini">FTP管理</el-button> |
| | | </el-popover> |
| | |
| | | :visible.sync="updateParams.show" width="5.2rem" |
| | | :close-on-click-modal=false |
| | | @closed="updateParamsClosed"> |
| | | |
| | | <flex-layout> |
| | | <div class="formFtp-content color-black"> |
| | | <el-form class="formFtp" label-position="right" size="small" label-width="144px" :rules="formFtp.rules" :model="formFtp.data"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="备份周期(分钟)" prop="updateCycle"> |
| | | <el-input v-model.number="formFtp.data.updateCycle"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="备份有效期(天)" prop="backupMaxTimelong"> |
| | | <el-input v-model.number="formFtp.data.backupMaxTimelong"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-form> |
| | | </div> |
| | | <div slot="footer" class="color-black dialog-footer"> |
| | | <el-button type="default" size="small" @click="updateParams.show = false">取 消</el-button> |
| | | <el-button type="primary" size="small" @click="editParamsOk">确 定</el-button> |
| | | </div> |
| | | </flex-layout> |
| | | </el-dialog> |
| | | <form |
| | | ref="export" |
| | |
| | | updateParams: { |
| | | show: false, |
| | | }, |
| | | formFtp: { |
| | | data: { |
| | | cfg_id: '', |
| | | updateCycle: '', |
| | | backupMaxTimelong: '', |
| | | }, |
| | | rules: { |
| | | updateCycle: [ |
| | | { required: true, message: '请输入周期值', trigger: 'blur' }, |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | // console.log(rule, value, callback); |
| | | console.log(value, callback); |
| | | if (value < 2) { |
| | | callback(new Error('周期值不能小于2')) |
| | | } else { |
| | | callback() |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | backupMaxTimelong: [ |
| | | { required: true, message: '请输入有效期', trigger: 'blur' }, |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | if (value < 1 || value > 366) { |
| | | callback(new Error('有效期必须在1~366之间')) |
| | | } else { |
| | | callback() |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | }, |
| | | } |
| | | } |
| | | }, |
| | | mounted () { |
| | |
| | | console.log(res.data); |
| | | if(res.data<100) { |
| | | setTimeout(self.getProgress, 10); |
| | | } |
| | | }); |
| | | }, |
| | | editParams () { |
| | | this.getParams(); |
| | | this.updateParams.show = true; |
| | | }, |
| | | editParamsOk () { |
| | | let param = { |
| | | cfg_id: this.formFtp.data.cfg_id, |
| | | update_cycle: this.formFtp.data.updateCycle, |
| | | backup_max_timelong: this.formFtp.data.backupMaxTimelong |
| | | }; |
| | | this.$api.file.updateParams(param).then((res) => { |
| | | let data = JSON.parse(res.data.result); |
| | | console.log(data, '====data'); |
| | | if (data.code) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: data.msg |
| | | }); |
| | | this.updateParams.show = false; |
| | | } else { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: data.msg |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | // 查看文件 |
| | | viewFolder () { |
| | | this.$api.file.getParams().then((res) => { |
| | | var re = JSON.parse(res.data.result); |
| | | // console.log(re, '====re'); |
| | | if (re.code == 1) { |
| | | this.$api.file.viewFolder(re.data[0].backup_path).then((res) => { |
| | | let data = JSON.parse(res.data.result); |
| | | if (data.code) { |
| | | this.$message({ |
| | | type: 'success', |
| | | message: data.msg |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: data.msg |
| | | }); |
| | | } |
| | | }); |
| | | } else { |
| | | this.$message({ |
| | | type: 'warning', |
| | | message: re.msg |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | // 查询配置 |
| | | getParams () { |
| | | this.$api.file.getParams().then((res) => { |
| | | var re = JSON.parse(res.data.result); |
| | | // console.log(re, '====re'); |
| | | if (re.code == 1) { |
| | | this.formFtp.data.updateCycle = re.data[0].update_cycle; |
| | | this.formFtp.data.backupMaxTimelong = re.data[0].backup_max_timelong; |
| | | this.formFtp.data.cfg_id = re.data[0].cfg_id; |
| | | } else { |
| | | this.formFtp.data.updateCycle = ''; |
| | | this.formFtp.data.backupMaxTimelong = ''; |
| | | } |
| | | }); |
| | | }, |
| | |
| | | padding-top: 0.08rem; |
| | | padding-bottom: 0.08rem; |
| | | } |
| | | |
| | | .formFtp { |
| | | padding: .1rem; |
| | | } |
| | | .dialog-footer { |
| | | box-sizing: border-box; |
| | | padding: 0.08rem; |
| | | text-align: right; |
| | | } |
| | | |
| | | </style> |
| | | |