|
@@ -75,112 +75,117 @@
|
|
|
import Http from '@/js/http.js'
|
|
|
import Apis from '@/js/api.js'
|
|
|
import ReportType from '@/constants/enum/report-type.js'
|
|
|
+
|
|
|
export default {
|
|
|
- name: "ReportCreate",
|
|
|
+ name: 'ReportCreate',
|
|
|
components: {},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
- reportType:ReportType,
|
|
|
+ reportType: ReportType,
|
|
|
report: {
|
|
|
- name: "",
|
|
|
+ name: '',
|
|
|
abstract: {
|
|
|
- target: "",
|
|
|
- content: ""
|
|
|
+ target: '',
|
|
|
+ content: ''
|
|
|
},
|
|
|
file: [],
|
|
|
- type: "",
|
|
|
- conclusion: ""
|
|
|
+ type: '',
|
|
|
+ conclusion: ''
|
|
|
},
|
|
|
rules: {
|
|
|
name: [
|
|
|
- { required: true, message: "请输入报告名称", trigger: "blur" }
|
|
|
+ {required: true, message: '请输入报告名称', trigger: 'blur'}
|
|
|
// { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
|
|
|
],
|
|
|
abstract: [
|
|
|
{
|
|
|
required: true,
|
|
|
- message: "请输入摘要信息",
|
|
|
- trigger: "change"
|
|
|
+ message: '请输入摘要信息',
|
|
|
+ trigger: 'change'
|
|
|
}
|
|
|
],
|
|
|
type: [
|
|
|
- { required: true, message: "请选择报告类型", trigger: "change" }
|
|
|
+ {required: true, message: '请选择报告类型', trigger: 'change'}
|
|
|
],
|
|
|
file: [
|
|
|
- { required: true, message: "请上传报告文件", trigger: "change" }
|
|
|
+ {required: true, message: '请上传报告文件', trigger: 'change'}
|
|
|
],
|
|
|
conclusion: [
|
|
|
- { required: true, message: "请输入报告结论", trigger: "blur" }
|
|
|
+ {required: true, message: '请输入报告结论', trigger: 'blur'}
|
|
|
]
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted () {
|
|
|
},
|
|
|
- mounted() {},
|
|
|
methods: {
|
|
|
- submitForm(formName) {
|
|
|
+ submitForm (formName) {
|
|
|
console.log(this.report)
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
- Http.post(Apis.REPORT,this.report).then((res)=>{
|
|
|
+ Http.post(Apis.REPORT, this.report).then((res) => {
|
|
|
console.log(this.report)
|
|
|
console.log(res)
|
|
|
})
|
|
|
//提交 report
|
|
|
} else {
|
|
|
- console.log("error submit!!");
|
|
|
- return false;
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
- resetForm(formName) {
|
|
|
- this.$refs[formName].resetFields();
|
|
|
- this.report.name = "";
|
|
|
- this.report.abstract.target = "";
|
|
|
- this.report.abstract.content = "";
|
|
|
- this.report.file = [];
|
|
|
- this.report.type = "";
|
|
|
- this.report.conclusion = "";
|
|
|
+ resetForm (formName) {
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
+ this.report.name = ''
|
|
|
+ this.report.abstract.target = ''
|
|
|
+ this.report.abstract.content = ''
|
|
|
+ this.report.file = []
|
|
|
+ this.report.type = ''
|
|
|
+ this.report.conclusion = ''
|
|
|
},
|
|
|
- cancelCreate() {
|
|
|
+ cancelCreate () {
|
|
|
if (window.history.length <= 1) {
|
|
|
- this.$router.push({ path: "/" });
|
|
|
- return false;
|
|
|
+ this.$router.push({path: '/'})
|
|
|
+ return false
|
|
|
} else {
|
|
|
- this.$router.go(-1);
|
|
|
+ this.$router.go(-1)
|
|
|
}
|
|
|
},
|
|
|
- handleRemove(file, fileList) {
|
|
|
- console.log(file, fileList);
|
|
|
+ handleRemove (file, fileList) {
|
|
|
+ console.log(file, fileList)
|
|
|
},
|
|
|
- handleExceed(files, fileList) {
|
|
|
+ handleExceed (files, fileList) {
|
|
|
this.$message.warning(
|
|
|
`当前限制选择 1 个文件,本次选择了 ${
|
|
|
files.length
|
|
|
- } 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
|
|
- );
|
|
|
+ } 个文件,共选择了 ${files.length + fileList.length} 个文件`
|
|
|
+ )
|
|
|
},
|
|
|
- beforeRemove(file, fileList) {
|
|
|
- return this.$confirm(`确定移除 ${file.name}?`);
|
|
|
+ beforeRemove (file, fileList) {
|
|
|
+ return this.$confirm(`确定移除 ${file.name}?`)
|
|
|
},
|
|
|
- beforeFileUpload() {},
|
|
|
- loadData() {
|
|
|
- Http.get(Apis.REPORT).then((res)=>{
|
|
|
+ beforeFileUpload () {
|
|
|
+ },
|
|
|
+ loadData () {
|
|
|
+ Http.get(Apis.REPORT).then((res) => {
|
|
|
this.report = res.report
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
-.el-radio {
|
|
|
- margin: 10px 20px 10px 0;
|
|
|
-}
|
|
|
-.el-form-item /deep/.el-tabs__content {
|
|
|
- max-height: 120px !important;
|
|
|
- overflow: auto;
|
|
|
-}
|
|
|
-.el-row {
|
|
|
- margin-bottom: 10px;
|
|
|
-}
|
|
|
+ .el-radio {
|
|
|
+ margin: 10px 20px 10px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-form-item /deep/ .el-tabs__content {
|
|
|
+ max-height: 120px !important;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-row {
|
|
|
+ margin-bottom: 10px;
|
|
|
+ }
|
|
|
</style>
|