| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | userInfo: {}, |
| | | image_path: require("@/assets/img/下载.png"), |
| | | // 新增表单验证规则 |
| | | formRules: { |
| | |
| | | ] |
| | | } |
| | | }, |
| | | created(){ |
| | | this.userInfo = sessionStorage.getItem("userInfo") && JSON.parse(sessionStorage.getItem("userInfo")) |
| | | }, |
| | | mounted() { |
| | | this.fetchFiles() |
| | | }, |
| | |
| | | const reader = new FileReader(); |
| | | reader.onload = (e) => { |
| | | this.$set(this.currentFile, 'iconUrl', e.target.result); |
| | | this.$set(this.currentFile, 'iconUrl2', e.target.result); |
| | | }; |
| | | reader.readAsDataURL(file.raw); |
| | | return false; |
| | |
| | | |
| | | // 创建文件 |
| | | async createFile(file) { |
| | | // console.info("userInfo:"+JSON.stringify(this.userInfo)) |
| | | try { |
| | | // 实际调用API接口 |
| | | await WarnAPI.createFile({ |
| | | fileName: file.fileName, |
| | | warningRules: file.warningRules, |
| | | rangeValue: file.rangeValue |
| | | rangeValue: file.rangeValue, |
| | | createUser:this.userInfo.id, |
| | | iconUrl:file.iconUrl2 |
| | | }) |
| | | this.$message.success('添加成功') |
| | | this.fetchFiles() |
| | |
| | | fileName: file.fileName, |
| | | warningRules: file.warningRules, |
| | | rangeValue: file.rangeValue, |
| | | iconUrl:file.iconUrl |
| | | iconUrl:file.iconUrl2 |
| | | }) |
| | | this.$message.success('编辑成功') |
| | | this.fetchFiles() |