Commit 066a364e authored by 周远喜's avatar 周远喜

ok

parent 156fde65
...@@ -56,7 +56,12 @@ export default { ...@@ -56,7 +56,12 @@ export default {
field: "", field: "",
}, },
rules: { rules: {
name: [{ title: [{
required: true,
message: '必填',
trigger: 'blur'
}],
workHour: [{
required: true, required: true,
message: '必填', message: '必填',
trigger: 'blur' trigger: 'blur'
......
<template> <template>
<div style="width:100%;overflow:auto"> <div class="flex">
<div style="width:80%; border-right:1px solid #ccc;padding-right:30px;float:left"> <div class="fg1" >
<Form :label-width="5" ref="formValidate"> <Card>
<Row> <p slot="title">任务信息</p>
<Col :span="8"> <div class="detail">
<FormItem label> <Row>
<span style="float:left">{{l('title')}}&nbsp;</span> <Filed :span="6" :name="l('creationTime')">{{entity.creationTime}}</Filed>
{{entity.title}} <Filed :span="6" :name="l('creatorUserId')">
</FormItem> <User :value="entity.creatorUserId"/>
</Col> </Filed>
<Col :span="8"> <Filed :span="6" :name="l('level')">
<FormItem label> <State code="project.task.level" :value="entity.level"/>
<span style="float:left">{{l('level')}}&nbsp;</span> </Filed>
<state code="project.task.level" :value="entity.level" type="text"></state> <Filed :span="6" :name="l('status')">
</FormItem> <State code="project.task.status" :value="entity.status"/>
</Col> </Filed>
<Col :span="8"> <Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<FormItem label> <Filed :span="12" :name="l('userId')">{{entity.userId}}
<span style="float:left">{{l('status')}}&nbsp;</span> <User :value="entity.creatorUserId"/>
<state code="project.task.status" :value="entity.status" type="text"></state> </Filed>
</FormItem> <Filed :span="24" :name="l('userIds')">
</Col> <User v-for="(li,i) in entity.userIds" :value="li" class="ml10"/>
<Col :span="8"> </Filed>
<FormItem label> <Filed :span="12" :name="l('startDate')"> <DateRange :value="entity"></DateRange></Filed>
<span style="float:left">{{l('userId')}}&nbsp;</span> <Filed :span="12" :name="l('plansToStartDate')"><DateRange :value="entity" start="plansToStartDate" end="plansToEndTime"></DateRange></Filed>
<User :value="parseInt(entity.userId)"></User> <Filed :span="24" :name="l('note')">
</FormItem> <div v-html="entity.note"></div>
</Col> </Filed>
<Col :span="8">
<FormItem label> <!-- <Filed :span="12" :name="l('plansToEndTime')">{{entity.plansToEndTime}}</Filed> -->
<span style="float:left">计划日期:&nbsp;</span> <!-- <Filed :span="12" :name="l('completePercentage')">{{entity.completePercentage}}</Filed>
<DateRange v-model="timeValuePlan" mode='d'> <Filed :span="12" :name="l('upTaskId')">{{entity.upTaskId}}</Filed> -->
</DateRange> </Row>
</FormItem>
</Col> </div>
<Col :span="8"> </Form>
<FormItem label> </Card>
<span style="float:left">实际日期:&nbsp;</span> <Card class="mt10" v-if="entity.status!=2">
<DateRange v-model="timeValue"></DateRange> <p slot="title">任务汇报</p>
</FormItem> <div class="form">
</Col> <Form :label-width="120" ref="formValidate">
</Row>
<Row :gutter="24" index="">
<Col :span="24">
<FormItem label><span style="float:left">{{l('note')}}&nbsp;</span>
<div style="height:200px;background:#fff;border:#c5c5c5 solid 1px;margin-left:50px;padding:10px;" v-html="entity.note" class="tex_in10"></div>
</FormItem>
</Col>
<Col :span="8">
<FormItem label>
<span style="float:left">{{l('creationTime')}}&nbsp;</span>
{{entity.creationTime}}
</FormItem>
</Col>
<Col :span="8">
<FormItem label>
<span style="float:left">{{l('creatorUserId')}}&nbsp;</span>
<User :value="entity.creatorUserId"></User>
</FormItem>
</Col>
</Row>
<Row :gutter="24"> <Row :gutter="24">
<Col :span="8"> <Col :span="24">
<FormItem label> <FormItem label="任务状态">
<span style="float:left">操作:&nbsp;</span> <RadioGroup v-model="status">
<Dictionary ref="dicRadio" code="project.task.status" v-model="entitySave.status" type="radio"></Dictionary> <Radio :label="1">工作中</Radio>
</FormItem> <Radio :label="2">完成</Radio>
</Col> <Radio :label="3">冻结</Radio>
<Col :span="8" v-if="entity.status==1"> </RadioGroup>
<FormItem label>
<span style="float:left">工时:&nbsp;</span>
<InputNumber v-model="entitySave.workHour" :min="0"></InputNumber>
</FormItem> </FormItem>
</Col> </Col>
</Row> <Col :span="12">
</Form> <FormItem label="标题" prop="title"> <Input v-model="entitysave.title"/>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="工时" prop="workHour">
<InputNumber v-model="entitysave.workHour" :min="0"></InputNumber>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="内容" prop="note">
<Input type="textarea" v-model="entitysave.note" :height="100" />
</FormItem>
</Col>
<Col :span="12">
<FormItem label="附件" prop="attachment">
<files ref="refFile" :parms="parms" files />
</Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button
type="primary"
@click="updatepart"
class="mr10"
>确定</Button
><Button @click="handleClose">取消</Button>
</FormItem>
</Form>
</div>
</Card>
</div> </div>
<div class="rightDiv" :style="{height:divHeight}"> <div v-width="500" class="pl20">
<component :is="detail" :eid="curId" /> <Card>
<p slot="title">工作记录</p>
<component :is="detail" :eid="curId" />
</Card>
</div> </div>
<FooterToolbar class="ftball">
<div class="tip"><Button type="primary" @click="updatepart" v-if="newStatusList.length>0">确定</Button><Button @click="handleClose">取消</Button></div> </div>
</FooterToolbar>
</div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
import ApiRecord from '../record/api' import ApiRecord from "../record/api";
export default { export default {
name: 'Add', name: "Add",
data() { data() {
return { return {
entity: {}, entity: {},
entitySave: {}, parms: {
timeValue: { app: "taskRecord",
startDate: "", eid: null,
endDate: "", name: "",
}, field: "",
timeValuePlan: { },
startDate: "", status: null,
endDate: "", entitysave: {
}, projectId: "",
divHeight: '200px', planId: "",
rules: { workHour: 0,
name: [{ title: "",
required: true, note: "",
message: '必填', attachment: "",
trigger: 'blur' taskId: "",
}], },
code: [{ timeValue: {
required: true, startDate: "",
message: '必填', endDate: "",
trigger: 'blur' },
}] timeValuePlan: {
}, startDate: "",
detail: null, endDate: "",
curId: '', },
newStatusList: [], divHeight: "200px",
} rules: {
title: [
{
required: true,
message: "必填",
trigger: "blur",
},
],
workHour: [
{
required: true,
message: "必填",
trigger: "blur",
},
],
},
detail: null,
curId: "",
};
},
props: {
eid: String,
},
created() {},
mounted() {
if (this.eid) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({
id: v,
}).then((r) => {
this.entity = r.result;
this.status = this.entity.status;
this.entitysave.projectId = this.entity.projectId;
this.entitysave.planId = this.entity.planId;
this.entitysave.taskId = this.eid;
//控制radio显示end
this.$emit("on-load");
this.curId = v;
this.detail = () => import("../record/recordTimeLine");
});
}, },
props: { updatepart() {
eid: String if (this.status != this.entity.status) {
let params = {
id: this.eid,
status: this.status,
};
Api.updatepart(params).then((r) => {
if (r.success) {
this.$Message.success("任务状态汇报成功");
this.$emit("on-ok");
} else {
this.$Message.error("操作失败");
}
});
}
ApiRecord.create(this.entitysave)
.then((res) => {
if (res.success) {
this.$Message.success("工时汇报成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
}, },
created() { handleClose() {
this.divHeight = window.innerHeight - 150 + 'px' this.$emit("on-close");
}, },
mounted() { l(key) {
if (this.eid != '' && this.eid != null) { key = "project_task" + "." + key;
this.load(this.eid); return this.$t(key);
}
window.onresize = () => {
return (() => {
this.divHeight = window.innerHeight - 150 + 'px'
})()
}
}, },
methods: { },
load(v) { watch: {
Api.get({ eid(v) {
id: v if (v) {
}).then(r => { this.load(v);
this.entity = r.result; }
this.timeValue = {
startDate: r.result.startDate,
endDate: r.result.endDate,
};
this.timeValuePlan = {
startDate: r.result.plansToStartDate,
endDate: r.result.plansToEndTime,
};
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() {
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
}
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')
},
l(key) {
key = "project_task" + "." + key;
return this.$t(key)
}
}, },
watch: { },
eid(v) { };
if (v != '' && v != null) {
this.load(v);
}
}
}
}
</script> </script>
<style scoped> <style scoped>
.tex_in10 { .tex_in10 {
text-align: inherit !important; text-align: inherit !important;
} }
.rightDiv { .rightDiv {
width: 18%; width: 18%;
float: left; float: left;
padding-left: 50px; padding-left: 50px;
} }
</style> </style>
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