|
@@ -62,7 +62,8 @@
|
|
|
</el-upload>
|
|
|
<div v-if="!isModifyMode">
|
|
|
<span v-if="report.file.length==0">暂无文件</span>
|
|
|
- <a :href="report.file[0].url" v-if="report.file.length>0"><i class="fa fa-file-text-o"></i> {{report.file[0].name}}</a>
|
|
|
+ <a :href="report.file[0].url" v-if="report.file.length>0"><i class="fa fa-file-text-o"></i>
|
|
|
+ {{report.file[0].name}}</a>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -87,55 +88,56 @@
|
|
|
<script>
|
|
|
import Http from '@/js/http.js'
|
|
|
import Apis from '@/js/api.js'
|
|
|
+
|
|
|
export default {
|
|
|
- name: "Report-Create",
|
|
|
+ name: 'Report-Create',
|
|
|
components: {},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
reportId: 0,
|
|
|
isModifyMode: false,
|
|
|
report: {
|
|
|
- name: "测试报告1",
|
|
|
+ name: '测试报告1',
|
|
|
abstract: {
|
|
|
- target: "测试对象xxxx",
|
|
|
- content: "测试内容xxxxx"
|
|
|
+ target: '测试对象xxxx',
|
|
|
+ content: '测试内容xxxxx'
|
|
|
},
|
|
|
- file: [{ name: "report5", url: "report5.excel" }],
|
|
|
- type: "项目测试方案",
|
|
|
- conclusion: "app挺好"
|
|
|
+ file: [{name: 'report5', url: 'report5.excel'}],
|
|
|
+ type: '项目测试方案',
|
|
|
+ conclusion: 'app挺好'
|
|
|
},
|
|
|
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'}
|
|
|
],
|
|
|
conclusion: [
|
|
|
- { required: true, message: "请输入报告结论", trigger: "blur" }
|
|
|
+ {required: true, message: '请输入报告结论', trigger: 'blur'}
|
|
|
]
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ mounted () {
|
|
|
this.$nextTick(() => {
|
|
|
- this.init();
|
|
|
- });
|
|
|
+ this.init()
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
- init() {
|
|
|
- this.reportId = +this.$route.params.reportId;
|
|
|
+ init () {
|
|
|
+ this.reportId = +this.$route.params.reportId
|
|
|
},
|
|
|
- modifyForm() {
|
|
|
- this.isModifyMode = true;
|
|
|
+ modifyForm () {
|
|
|
+ this.isModifyMode = true
|
|
|
//请求 report
|
|
|
// this.report = {
|
|
|
// name: "测试报告1",
|
|
@@ -148,84 +150,87 @@ export default {
|
|
|
// conclusion: "app挺好"
|
|
|
// };
|
|
|
},
|
|
|
- submitForm(formName) {
|
|
|
+ submitForm (formName) {
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
- this.isModifyMode = false;
|
|
|
- Http.post(Apis.REPORT.UPDATE_REPORT_SUBMIT,this.report).then((res)=>{
|
|
|
+ this.isModifyMode = false
|
|
|
+ Http.post(Apis.REPORT.UPDATE_REPORT_SUBMIT, 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() {
|
|
|
- this.isModifyMode = false;
|
|
|
+ cancelCreate () {
|
|
|
+ this.isModifyMode = false
|
|
|
//请求 report
|
|
|
this.report = {
|
|
|
- name: "测试报告1",
|
|
|
+ name: '测试报告1',
|
|
|
abstract: {
|
|
|
- target: "测试对象xxxx",
|
|
|
- content: "测试内容xxxxx"
|
|
|
+ target: '测试对象xxxx',
|
|
|
+ content: '测试内容xxxxx'
|
|
|
},
|
|
|
- file: [{ name: "report5", url: "report5.excel" }],
|
|
|
- type: "项目测试方案",
|
|
|
- conclusion: "app挺好"
|
|
|
- };
|
|
|
+ file: [{name: 'report5', url: 'report5.excel'}],
|
|
|
+ type: '项目测试方案',
|
|
|
+ conclusion: 'app挺好'
|
|
|
+ }
|
|
|
},
|
|
|
- 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() {},
|
|
|
- back(){
|
|
|
+ beforeFileUpload () {
|
|
|
+ },
|
|
|
+ back () {
|
|
|
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)
|
|
|
}
|
|
|
},
|
|
|
- loadData() {
|
|
|
- Http.get(Apis.PAGE.REPORT_DETAIL_PAGE).then((res)=>{
|
|
|
+ loadData () {
|
|
|
+ Http.get(Apis.PAGE.REPORT_DETAIL_PAGE).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>
|