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

ok

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