|
|
@@ -68,7 +68,7 @@
|
|
|
:picker-options="pickerOptions"
|
|
|
></el-date-picker>
|
|
|
</div>
|
|
|
- <span v-if="!isModifyMode">{{new Date(task.datetime)}}</span>
|
|
|
+ <span v-if="!isModifyMode">{{task.datetime}}</span>
|
|
|
</el-form-item>
|
|
|
<el-form-item v-if="isModifyMode">
|
|
|
<div class="btn btn-medium btn-info" @click="submitForm('task')">确认修改</div>
|
|
|
@@ -85,206 +85,227 @@
|
|
|
</div>
|
|
|
<div class="create-body" v-if="!isModifyMode">
|
|
|
<div class="title h2">报告列表</div>
|
|
|
- <report-list/>
|
|
|
+ <report-list v-bind:reports="reportList"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Enum from "@/constants/enum/index";
|
|
|
-import provincecity from "@/components/commons/ProvinceCity";
|
|
|
-import provinceCityJSON from "@/constants/provinceCity.json";
|
|
|
-import ReportList from "@/components/report/ReportList";
|
|
|
+import Enum from '@/constants/enum/index'
|
|
|
+import provincecity from '@/components/commons/ProvinceCity'
|
|
|
+import provinceCityJSON from '@/constants/provinceCity.json'
|
|
|
+import ReportList from '@/components/report/ReportList'
|
|
|
+
|
|
|
export default {
|
|
|
- name: "Task",
|
|
|
+ name: 'Task',
|
|
|
components: {
|
|
|
provincecity,
|
|
|
ReportList
|
|
|
},
|
|
|
- data() {
|
|
|
+ data () {
|
|
|
return {
|
|
|
- projectId: 0,
|
|
|
- taskId: 0,
|
|
|
isModifyMode: false,
|
|
|
institutionArray: Enum.institution,
|
|
|
- tabPosition: "top",
|
|
|
+ tabPosition: 'top',
|
|
|
task: {
|
|
|
- name: "任务名称xxxxs",
|
|
|
- desc: "任务描述文字",
|
|
|
- type: "安全漏洞扫描",
|
|
|
- resource: "区域", //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
- location: { provinceCode: "3200", cityCode: "3201" },
|
|
|
- institution: "",
|
|
|
- datetime: new Date("2018-11-11 23:11:11")
|
|
|
+ id: 0,
|
|
|
+ projectId: 0,
|
|
|
+ name: '任务名称xxxxs',
|
|
|
+ desc: '任务描述文字',
|
|
|
+ type: '安全漏洞扫描',
|
|
|
+ resource: '区域', //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
+ location: {provinceCode: '3200', cityCode: '3201'},
|
|
|
+ institution: '',
|
|
|
+ datetime: new Date('2018-11-11 23:11:11')
|
|
|
},
|
|
|
+ reportList: [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ type: '项目可行性报告',
|
|
|
+ file: []
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ type: '项目测试方案(汇总)',
|
|
|
+ file: [{name: 'report2', url: 'report2.excel'}]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ type: '项目测试报告(汇总)',
|
|
|
+ file: [{name: 'report3', url: 'report3.excel'}]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ type: '项目缺陷报告(汇总)',
|
|
|
+ file: [{name: 'report4', url: 'report4.excel'}]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 5,
|
|
|
+ type: '项目用例报告(汇总)',
|
|
|
+ file: [{name: 'report5', url: 'report5.excel'}]
|
|
|
+ }
|
|
|
+ ],
|
|
|
pickerOptions: {
|
|
|
shortcuts: [
|
|
|
{
|
|
|
- text: "今天",
|
|
|
- onClick(picker) {
|
|
|
- picker.$emit("pick", new Date());
|
|
|
+ text: '今天',
|
|
|
+ onClick (picker) {
|
|
|
+ picker.$emit('pick', new Date())
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- text: "昨天",
|
|
|
- onClick(picker) {
|
|
|
- const date = new Date();
|
|
|
- date.setTime(date.getTime() - 3600 * 1000 * 24);
|
|
|
- picker.$emit("pick", date);
|
|
|
+ text: '昨天',
|
|
|
+ onClick (picker) {
|
|
|
+ const date = new Date()
|
|
|
+ date.setTime(date.getTime() - 3600 * 1000 * 24)
|
|
|
+ picker.$emit('pick', date)
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- text: "一周前",
|
|
|
- onClick(picker) {
|
|
|
- const date = new Date();
|
|
|
- date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
- picker.$emit("pick", date);
|
|
|
+ text: '一周前',
|
|
|
+ onClick (picker) {
|
|
|
+ const date = new Date()
|
|
|
+ date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
|
|
|
+ picker.$emit('pick', date)
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
rules: {
|
|
|
name: [
|
|
|
- { required: true, message: "请输入任务名称", trigger: "blur" }
|
|
|
+ {required: true, message: '请输入任务名称', trigger: 'blur'}
|
|
|
// { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" }
|
|
|
],
|
|
|
datetime: [
|
|
|
{
|
|
|
- type: "date",
|
|
|
+ type: 'date',
|
|
|
required: true,
|
|
|
- message: "请选择截止时间",
|
|
|
- trigger: "change"
|
|
|
+ message: '请选择截止时间',
|
|
|
+ trigger: 'change'
|
|
|
}
|
|
|
],
|
|
|
type: [
|
|
|
- { required: true, message: "请选择业务类型", trigger: "change" }
|
|
|
+ {required: true, message: '请选择业务类型', trigger: 'change'}
|
|
|
],
|
|
|
- desc: [{ required: true, message: "请填写任务描述", trigger: "blur" }]
|
|
|
+ desc: [{required: true, message: '请填写任务描述', trigger: 'blur'}]
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
- "task.institution"() {
|
|
|
+ 'task.institution' () {
|
|
|
if (this.task.institution) {
|
|
|
- this.$refs.addFormProvince.resetProviceCity();
|
|
|
- this.task.location = { provinceCode: "", cityCode: "" };
|
|
|
+ this.$refs.addFormProvince.resetProviceCity()
|
|
|
+ this.task.location = {provinceCode: '', cityCode: ''}
|
|
|
}
|
|
|
},
|
|
|
- "task.location"() {
|
|
|
+ 'task.location' () {
|
|
|
if (this.task.location.provinceCode || this.task.location.cityCode) {
|
|
|
- this.task.institution = "";
|
|
|
+ this.task.institution = ''
|
|
|
}
|
|
|
},
|
|
|
- "task.resource"() {
|
|
|
- if (this.task.resource == "广场") {
|
|
|
- this.$refs.addFormProvince.resetProviceCity();
|
|
|
- this.task.institution = "";
|
|
|
- this.task.location = { provinceCode: "", cityCode: "" };
|
|
|
+ 'task.resource' () {
|
|
|
+ if (this.task.resource == '广场') {
|
|
|
+ this.$refs.addFormProvince.resetProviceCity()
|
|
|
+ this.task.institution = ''
|
|
|
+ this.task.location = {provinceCode: '', cityCode: ''}
|
|
|
}
|
|
|
},
|
|
|
deep: true
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ mounted () {
|
|
|
this.$nextTick(() => {
|
|
|
- this.init();
|
|
|
- });
|
|
|
+ this.init()
|
|
|
+ })
|
|
|
},
|
|
|
methods: {
|
|
|
- init() {
|
|
|
- this.taskId = +this.$route.params.taskId;
|
|
|
- this.projectId = +this.$route.params.projectId;
|
|
|
+ init () {
|
|
|
+ this.task.taskId = +this.$route.params.taskId
|
|
|
+ this.task.projectId = +this.$route.params.projectId
|
|
|
},
|
|
|
- updateLocation(location) {
|
|
|
- var provinceName = "";
|
|
|
- var cityName = "";
|
|
|
+ updateLocation (location) {
|
|
|
+ var provinceName = ''
|
|
|
+ var cityName = ''
|
|
|
for (var item of provinceCityJSON.provinces) {
|
|
|
if (item.code === location.provinceCode) {
|
|
|
- provinceName = item.name;
|
|
|
+ provinceName = item.name
|
|
|
for (var city of item.cities) {
|
|
|
if (city.code === location.cityCode) {
|
|
|
- cityName = city.name;
|
|
|
- break;
|
|
|
+ cityName = city.name
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return provinceName + " / " + cityName;
|
|
|
+ return provinceName + ' / ' + cityName
|
|
|
},
|
|
|
- submitForm(formName) {
|
|
|
+ submitForm (formName) {
|
|
|
this.$refs[formName].validate(valid => {
|
|
|
if (valid) {
|
|
|
- this.isModifyMode = false;
|
|
|
- console.log(this.task);
|
|
|
+ this.isModifyMode = false
|
|
|
//提交 task
|
|
|
} else {
|
|
|
- console.log("error submit!!");
|
|
|
- return false;
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
- cancelMode(formName) {
|
|
|
- this.isModifyMode = false;
|
|
|
+ cancelMode (formName) {
|
|
|
+ this.isModifyMode = false
|
|
|
//获得task 信息
|
|
|
- this.task = {
|
|
|
- name: "任务名称xxxxs",
|
|
|
- desc: "任务描述文字",
|
|
|
- type: "安全漏洞扫描",
|
|
|
- resource: "区域", //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
- location: { provinceCode: "3200", cityCode: "3201" },
|
|
|
- institution: "",
|
|
|
- datetime: new Date("2018-11-11 23:11:11")
|
|
|
- };
|
|
|
+ // this.task = {
|
|
|
+ // name: "任务名称xxxxs",
|
|
|
+ // desc: "任务描述文字",
|
|
|
+ // type: "安全漏洞扫描",
|
|
|
+ // resource: "区域", //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
+ // location: { provinceCode: "3200", cityCode: "3201" },
|
|
|
+ // institution: "",
|
|
|
+ // datetime: new Date("2018-11-11 23:11:11")
|
|
|
+ // };
|
|
|
},
|
|
|
- modifyForm() {
|
|
|
- this.isModifyMode = true;
|
|
|
+ modifyForm () {
|
|
|
+ this.isModifyMode = true
|
|
|
//获得task 信息
|
|
|
- this.task = {
|
|
|
- name: "任务名称xxxxs",
|
|
|
- desc: "任务描述文字",
|
|
|
- type: "安全漏洞扫描",
|
|
|
- resource: "区域", //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
- location: { provinceCode: "3200", cityCode: "3201" },
|
|
|
- institution: "",
|
|
|
- datetime: new Date("2018-11-11 23:11:11")
|
|
|
- };
|
|
|
+
|
|
|
},
|
|
|
- resetForm(formName) {
|
|
|
- this.$refs.addFormProvince.resetProviceCity();
|
|
|
- this.$refs[formName].resetFields();
|
|
|
- this.task.name = "";
|
|
|
- this.task.desc = "";
|
|
|
- this.task.type = "";
|
|
|
- this.task.resource = "广场"; //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
- (this.task.location = { provinceCode: "", cityCode: "" }),
|
|
|
- (this.task.institution = "");
|
|
|
- this.task.datetime = "";
|
|
|
+ resetForm (formName) {
|
|
|
+ this.$refs.addFormProvince.resetProviceCity()
|
|
|
+ this.$refs[formName].resetFields()
|
|
|
+ this.task.name = ''
|
|
|
+ this.task.desc = ''
|
|
|
+ this.task.type = ''
|
|
|
+ this.task.resource = '广场'; //如果是广场不用管Location和institution ,定向看institution,区域看location
|
|
|
+ (this.task.location = {provinceCode: '', cityCode: ''}),
|
|
|
+ (this.task.institution = '')
|
|
|
+ this.task.datetime = ''
|
|
|
},
|
|
|
- locationChange(provinceId, cityId) {
|
|
|
- if (provinceId || cityId)
|
|
|
- this.task.location = { provinceCode: provinceId, cityCode: cityId };
|
|
|
+ locationChange (provinceId, cityId) {
|
|
|
+ if (provinceId || cityId) {
|
|
|
+ this.task.location = {provinceCode: provinceId, cityCode: cityId}
|
|
|
+ }
|
|
|
},
|
|
|
- toProject() {
|
|
|
+ toProject () {
|
|
|
this.$router.push({
|
|
|
- name: "Project",
|
|
|
- params: { projectId: this.projectId }
|
|
|
- });
|
|
|
+ name: 'Project',
|
|
|
+ params: {projectId: this.task.projectId}
|
|
|
+ })
|
|
|
},
|
|
|
- applyTask() {
|
|
|
- console.log("申请项目");
|
|
|
+ applyTask () {
|
|
|
+ console.log('申请项目')
|
|
|
},
|
|
|
- createReport() {
|
|
|
- this.$router.push({ name: "ReportCreate" });
|
|
|
+ createReport () {
|
|
|
+ this.$router.push({name: 'ReportCreate'})
|
|
|
},
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</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-radio {
|
|
|
+ margin: 10px 20px 10px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .el-form-item /deep/ .el-tabs__content {
|
|
|
+ max-height: 120px !important;
|
|
|
+ overflow: auto;
|
|
|
+ }
|
|
|
</style>
|