Commit a93c897b authored by renjintao's avatar renjintao

task/detail index record/add

parent 6fc8e6b8
...@@ -41,17 +41,9 @@ export default { ...@@ -41,17 +41,9 @@ export default {
return { return {
disabled: false, disabled: false,
entity: { entity: {
creationTime: null,
creatorUserId: null,
lastModificationTime: null,
lastModifierUserId: null,
isDeleted: null,
deletionTime: null,
deleterUserId: null,
projectId: "", projectId: "",
planId: "", planId: "",
workHour: 0, workHour: 0,
status: null,
title: "", title: "",
note: "", note: "",
attachment: "", attachment: "",
...@@ -74,11 +66,17 @@ export default { ...@@ -74,11 +66,17 @@ export default {
}, },
props: { props: {
v: Object, v: Object,
eid: String eid: String,
row: {
type: Object,
default: () => {
return null;
},
},
}, },
mounted() { mounted() {
if (this.eid != "") { if (this.eid != "") {
this.load(this.eid); // this.load(this.eid);
this.parms.eid = this.$u.guid(); this.parms.eid = this.$u.guid();
} }
}, },
...@@ -93,6 +91,8 @@ export default { ...@@ -93,6 +91,8 @@ export default {
} }
this.disabled = true; this.disabled = true;
this.entity.taskId = this.eid this.entity.taskId = this.eid
this.entity.projectId = this.row.projectId
this.entity.planId = this.row.planId
Api.create(this.entity).then((r) => { Api.create(this.entity).then((r) => {
this.disabled = false; this.disabled = false;
if (r.success) { if (r.success) {
...@@ -148,13 +148,19 @@ export default { ...@@ -148,13 +148,19 @@ export default {
}, },
watch: { watch: {
v() { v() {
this.entity = this.$u.clone(this.v) //this.entity = this.$u.clone(this.v)
}, },
eid(v) { eid(v) {
if (v != "") { if (v != "") {
this.load(v); this.load(v);
} }
},
row(v) {
if (v != null) {
//this.entity.projectId = v.projectId
//this.entity.planId = v.planId
} }
},
} }
} }
</script> </script>
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
<Col :span="8"> <Col :span="8">
<FormItem label> <FormItem label>
<span style="float:left">操作:&nbsp;</span> <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> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8" v-if="entity.status==1">
<FormItem label> <FormItem label>
<span style="float:left">工时:&nbsp;</span> <span style="float:left">工时:&nbsp;</span>
<InputNumber v-model="entitySave.workHour" :min="0"></InputNumber> <InputNumber v-model="entitySave.workHour" :min="0"></InputNumber>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<component :is="detail" :eid="curId" /> <component :is="detail" :eid="curId" />
</div> </div>
<FooterToolbar class="ftball"> <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> </FooterToolbar>
</div> </div>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
<script> <script>
import Api from './api' import Api from './api'
import ApiTask from '../task/api' import ApiRecord from '../record/api'
export default { export default {
name: 'Add', name: 'Add',
data() { data() {
...@@ -119,6 +119,7 @@ export default { ...@@ -119,6 +119,7 @@ export default {
}, },
detail: null, detail: null,
curId: '', curId: '',
newStatusList: [],
} }
}, },
props: { props: {
...@@ -153,24 +154,53 @@ export default { ...@@ -153,24 +154,53 @@ export default {
}; };
this.entitySave.status = this.$u.clone(this.entity.status); this.entitySave.status = this.$u.clone(this.entity.status);
this.entitySave.workHour = 0; 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.$emit('on-load');
this.curId = v; this.curId = v;
this.detail = () => import('../record/recordTimeLine'); this.detail = () => import('../record/recordTimeLine');
}) })
}, },
updatepart(valStatus) { updatepart() {
if (this.entitySave.status != this.entity.status) {
let params = { let params = {
id: this.eid, id: this.eid,
status: valStatus status: this.entitySave.status
} }
if (valStatus == 1) { if (this.entitySave.status == 1) {
params.startDate = '' params.startDate = ''
} }
if (valStatus == 2) { if (this.entitySave.status == 2) {
params.endDate = '' params.endDate = ''
} }
ApiTask.updatepart(params).then(r => { Api.updatepart(params).then(r => {
if (r.success) { if (r.success) {
this.$Message.success('操作成功') this.$Message.success('操作成功')
this.$emit('on-ok') this.$emit('on-ok')
...@@ -182,6 +212,31 @@ export default { ...@@ -182,6 +212,31 @@ export default {
this.$Message.error('操作失败') this.$Message.error('操作失败')
console.warn(err) console.warn(err)
}) })
} else {
this.handleClose()
}
if (this.entitySave.workHour > 0) {
let entityWorkHour = {
taskId: this.eid,
workHour: this.entitySave.workHour,
projectId: this.entity.projectId
}
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() { handleClose() {
this.$emit('on-close') this.$emit('on-close')
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</Form> </Form>
</template> </template>
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add">新增</Button> <Button type="primary" @click="add" v-if="planId!=''">新增</Button>
</template> </template>
<template slot="batch"> <template slot="batch">
<Button type="primary" class="mr10 ml10">开始</Button> <Button type="primary" class="mr10 ml10">开始</Button>
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" :fullscreen="fullScreen" footer-hide> <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> </Modal>
</Content> </Content>
</Layout> </Layout>
...@@ -116,6 +116,7 @@ export default { ...@@ -116,6 +116,7 @@ export default {
modal: false, modal: false,
title: "新增", title: "新增",
detail: null, detail: null,
rowObj: null,
curId: '', curId: '',
fullScreen: false, fullScreen: false,
projectId: '', projectId: '',
...@@ -260,7 +261,7 @@ export default { ...@@ -260,7 +261,7 @@ export default {
icon: "md-arrow-dropright-circle", icon: "md-arrow-dropright-circle",
type: "icon", type: "icon",
oprate: "edit", oprate: "edit",
title: params.row.status == 0 ? "开始" : params.row.status == 2 ? "继续" : '', title: "开始",
disable: params.row.status disable: params.row.status
}, },
on: { on: {
...@@ -273,7 +274,7 @@ export default { ...@@ -273,7 +274,7 @@ export default {
type: "icon", type: "icon",
oprate: "edit", oprate: "edit",
title: "回报工作", title: "回报工作",
disable: params.row.status == 1 ? 0 : 1 disable: params.row.status == 1 || params.row.status == 3 ? 0 : 1
}, },
on: { on: {
click: () => this.viewRecord(params.row.id, params.row.status) click: () => this.viewRecord(params.row.id, params.row.status)
...@@ -288,7 +289,7 @@ export default { ...@@ -288,7 +289,7 @@ export default {
disable: params.row.status == 1 ? 0 : 1 disable: params.row.status == 1 ? 0 : 1
}, },
on: { on: {
click: () => this.addRecord(params.row.id) click: () => this.addRecord(params.row)
} }
}), }),
h('op', { h('op', {
...@@ -355,7 +356,7 @@ export default { ...@@ -355,7 +356,7 @@ export default {
ok() { ok() {
this.$refs.grid.load() this.$refs.grid.load()
this.modal = false this.modal = false
this.curId = 0; this.curId = '';
}, },
search() { search() {
this.easySearch.planId.value = this.planIdsCur this.easySearch.planId.value = this.planIdsCur
...@@ -405,7 +406,7 @@ export default { ...@@ -405,7 +406,7 @@ export default {
}) })
}, },
cancel() { cancel() {
this.curId = 0; this.curId = '';
this.modal = false this.modal = false
}, },
onHide() { onHide() {
...@@ -473,8 +474,9 @@ export default { ...@@ -473,8 +474,9 @@ export default {
this.detail = () => import('../record') this.detail = () => import('../record')
this.modal = true; this.modal = true;
}, },
addRecord(id) { addRecord(row) {
this.curId = id; this.curId = row.id;
this.rowObj = row
this.title = "新增记录"; this.title = "新增记录";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import('../record/add') 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