Commit a93c897b authored by renjintao's avatar renjintao

task/detail index record/add

parent 6fc8e6b8
......@@ -41,17 +41,9 @@ export default {
return {
disabled: false,
entity: {
creationTime: null,
creatorUserId: null,
lastModificationTime: null,
lastModifierUserId: null,
isDeleted: null,
deletionTime: null,
deleterUserId: null,
projectId: "",
planId: "",
workHour: 0,
status: null,
title: "",
note: "",
attachment: "",
......@@ -74,11 +66,17 @@ export default {
},
props: {
v: Object,
eid: String
eid: String,
row: {
type: Object,
default: () => {
return null;
},
},
},
mounted() {
if (this.eid != "") {
this.load(this.eid);
// this.load(this.eid);
this.parms.eid = this.$u.guid();
}
},
......@@ -93,6 +91,8 @@ export default {
}
this.disabled = true;
this.entity.taskId = this.eid
this.entity.projectId = this.row.projectId
this.entity.planId = this.row.planId
Api.create(this.entity).then((r) => {
this.disabled = false;
if (r.success) {
......@@ -148,13 +148,19 @@ export default {
},
watch: {
v() {
this.entity = this.$u.clone(this.v)
//this.entity = this.$u.clone(this.v)
},
eid(v) {
if (v != "") {
this.load(v);
}
}
},
row(v) {
if (v != null) {
//this.entity.projectId = v.projectId
//this.entity.planId = v.planId
}
},
}
}
</script>
......@@ -64,10 +64,10 @@
<Col :span="8">
<FormItem label>
<span style="float:left">操作:&nbsp;</span>
<Dictionary code="project.task.status" v-model="entitySave.status" type="radio"></Dictionary>
<Dictionary ref="dicRadio" code="project.task.status" v-model="entitySave.status" type="radio"></Dictionary>
</FormItem>
</Col>
<Col :span="8">
<Col :span="8" v-if="entity.status==1">
<FormItem label>
<span style="float:left">工时:&nbsp;</span>
<InputNumber v-model="entitySave.workHour" :min="0"></InputNumber>
......@@ -81,7 +81,7 @@
<component :is="detail" :eid="curId" />
</div>
<FooterToolbar class="ftball">
<div class="tip"><Button type="primary" @click="updatepart(2)">确定</Button><Button @click="handleClose">取消</Button></div>
<div class="tip"><Button type="primary" @click="updatepart" v-if="newStatusList.length>0">确定</Button><Button @click="handleClose">取消</Button></div>
</FooterToolbar>
</div>
......@@ -89,7 +89,7 @@
<script>
import Api from './api'
import ApiTask from '../task/api'
import ApiRecord from '../record/api'
export default {
name: 'Add',
data() {
......@@ -119,6 +119,7 @@ export default {
},
detail: null,
curId: '',
newStatusList: [],
}
},
props: {
......@@ -153,35 +154,89 @@ export default {
};
this.entitySave.status = this.$u.clone(this.entity.status);
this.entitySave.workHour = 0;
//控制radio显示start
let statusList = this.$store.getters.dictionaryByKey('project.task.status');
this.newStatusList = []
if (this.entity.status == 0) {
statusList.forEach(el => {
if (el.code == 0 || el.code == 1 || el.code == 3) {
this.newStatusList.push(el)
}
})
} else if (this.entity.status == 1) {
statusList.forEach(el => {
if (el.code == 1 || el.code == 2 || el.code == 3) {
this.newStatusList.push(el)
}
})
} else if (this.entity.status == 3) {
statusList.forEach(el => {
if (el.code == 3 || el.code == 1 || el.code == 2) {
this.newStatusList.push(el)
}
})
}
this.$refs.dicRadio.data = []
this.$refs.dicRadio.data = this.newStatusList
this.entitySave.status = parseInt(this.entity.status)
//控制radio显示end
this.$emit('on-load');
this.curId = v;
this.detail = () => import('../record/recordTimeLine');
})
},
updatepart(valStatus) {
let params = {
id: this.eid,
status: valStatus
}
if (valStatus == 1) {
params.startDate = ''
}
if (valStatus == 2) {
params.endDate = ''
}
ApiTask.updatepart(params).then(r => {
if (r.success) {
this.$Message.success('操作成功')
this.$emit('on-ok')
} else {
updatepart() {
if (this.entitySave.status != this.entity.status) {
let params = {
id: this.eid,
status: this.entitySave.status
}
if (this.entitySave.status == 1) {
params.startDate = ''
}
if (this.entitySave.status == 2) {
params.endDate = ''
}
Api.updatepart(params).then(r => {
if (r.success) {
this.$Message.success('操作成功')
this.$emit('on-ok')
} else {
this.$Message.error('操作失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('操作失败')
console.warn(err)
})
} else {
this.handleClose()
}
if (this.entitySave.workHour > 0) {
let entityWorkHour = {
taskId: this.eid,
workHour: this.entitySave.workHour,
projectId: this.entity.projectId
}
}).catch(err => {
this.disabled = false;
this.$Message.error('操作失败')
console.warn(err)
})
if (this.entity.planId && this.entity.planId != '') {
entityWorkHour.planId = this.entity.planId
}
ApiRecord.create(entityWorkHour).then((res) => {
this.disabled = false;
if (res.success) {
this.$Message.success('保存工时成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
}).catch(err => {
this.$Message.error('保存失败')
})
}
},
handleClose() {
this.$emit('on-close')
......
......@@ -66,7 +66,7 @@
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
<Button type="primary" @click="add" v-if="planId!=''">新增</Button>
</template>
<template slot="batch">
<Button type="primary" class="mr10 ml10">开始</Button>
......@@ -75,7 +75,7 @@
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" :fullscreen="fullScreen" footer-hide>
<component :is="detail" :eid="curId" :pid="planId" @on-close="cancel" @on-ok="ok" />
<component :is="detail" :eid="curId" :pid="planId" :row="rowObj" @on-close="cancel" @on-ok="ok" />
</Modal>
</Content>
</Layout>
......@@ -116,6 +116,7 @@ export default {
modal: false,
title: "新增",
detail: null,
rowObj: null,
curId: '',
fullScreen: false,
projectId: '',
......@@ -260,7 +261,7 @@ export default {
icon: "md-arrow-dropright-circle",
type: "icon",
oprate: "edit",
title: params.row.status == 0 ? "开始" : params.row.status == 2 ? "继续" : '',
title: "开始",
disable: params.row.status
},
on: {
......@@ -273,7 +274,7 @@ export default {
type: "icon",
oprate: "edit",
title: "回报工作",
disable: params.row.status == 1 ? 0 : 1
disable: params.row.status == 1 || params.row.status == 3 ? 0 : 1
},
on: {
click: () => this.viewRecord(params.row.id, params.row.status)
......@@ -288,7 +289,7 @@ export default {
disable: params.row.status == 1 ? 0 : 1
},
on: {
click: () => this.addRecord(params.row.id)
click: () => this.addRecord(params.row)
}
}),
h('op', {
......@@ -355,7 +356,7 @@ export default {
ok() {
this.$refs.grid.load()
this.modal = false
this.curId = 0;
this.curId = '';
},
search() {
this.easySearch.planId.value = this.planIdsCur
......@@ -405,7 +406,7 @@ export default {
})
},
cancel() {
this.curId = 0;
this.curId = '';
this.modal = false
},
onHide() {
......@@ -473,8 +474,9 @@ export default {
this.detail = () => import('../record')
this.modal = true;
},
addRecord(id) {
this.curId = id;
addRecord(row) {
this.curId = row.id;
this.rowObj = row
this.title = "新增记录";
this.fullScreen = false;
this.detail = () => import('../record/add')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment