Commit 2664cf93 authored by renjintao's avatar renjintao

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product-rjt

parents 1fd296a3 70b273a2
...@@ -55,7 +55,12 @@ export default { ...@@ -55,7 +55,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>
<p slot="title">任务信息</p>
<div class="detail">
<Row> <Row>
<Col :span="8"> <Filed :span="6" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<FormItem label> <Filed :span="6" :name="l('creatorUserId')">
<span style="float:left">{{l('title')}}&nbsp;</span> <User :value="entity.creatorUserId"/>
{{entity.title}} </Filed>
</FormItem> <Filed :span="6" :name="l('level')">
</Col> <State code="project.task.level" :value="entity.level"/>
<Col :span="8"> </Filed>
<FormItem label> <Filed :span="6" :name="l('status')">
<span style="float:left">{{l('level')}}&nbsp;</span> <State code="project.task.status" :value="entity.status"/>
<state code="project.task.level" :value="entity.level" type="text"></state> </Filed>
</FormItem> <Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
</Col> <Filed :span="12" :name="l('userId')">{{entity.userId}}
<Col :span="8"> <User :value="entity.creatorUserId"/>
<FormItem label> </Filed>
<span style="float:left">{{l('status')}}&nbsp;</span> <Filed :span="24" :name="l('userIds')">
<state code="project.task.status" :value="entity.status" type="text"></state> <User v-for="(li,i) in entity.userIds" :value="li" :key="i" class="ml10"/>
</FormItem> </Filed>
</Col> <Filed :span="12" :name="l('startDate')"> <DateRange :value="entity"></DateRange></Filed>
<Col :span="8"> <Filed :span="12" :name="l('plansToStartDate')"><DateRange :value="entity" start="plansToStartDate" end="plansToEndTime"></DateRange></Filed>
<FormItem label> <Filed :span="24" :name="l('note')">
<span style="float:left">{{l('userId')}}&nbsp;</span> <div v-html="entity.note"></div>
<User :value="parseInt(entity.userId)"></User> </Filed>
</FormItem>
</Col> <!-- <Filed :span="12" :name="l('plansToEndTime')">{{entity.plansToEndTime}}</Filed> -->
<Col :span="8"> <!-- <Filed :span="12" :name="l('completePercentage')">{{entity.completePercentage}}</Filed>
<FormItem label> <Filed :span="12" :name="l('upTaskId')">{{entity.upTaskId}}</Filed> -->
<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>
</Row> </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"> <Col :span="24">
<FormItem label><span style="float:left">{{l('note')}}&nbsp;</span> <FormItem label="任务状态">
<div style="height:200px;background:#fff;border:#c5c5c5 solid 1px;margin-left:50px;padding:10px;" v-html="entity.note" class="tex_in10"></div> <RadioGroup v-model="status">
<Radio :label="1">工作中</Radio>
<Radio :label="2">完成</Radio>
<Radio :label="3">冻结</Radio>
</RadioGroup>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="12">
<FormItem label> <FormItem label="标题" prop="title"> <Input v-model="entitysave.title"/>
<span style="float:left">{{l('creationTime')}}&nbsp;</span> </FormItem>
{{entity.creationTime}}
</FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="12">
<FormItem label> <FormItem label="工时" prop="workHour">
<span style="float:left">{{l('creatorUserId')}}&nbsp;</span> <InputNumber v-model="entitysave.workHour" :min="0"></InputNumber>
<User :value="entity.creatorUserId"></User>
</FormItem> </FormItem>
</Col> </Col>
</Row>
<Row :gutter="24"> <Col :span="24">
<Col :span="8"> <FormItem label="内容" prop="note">
<FormItem label> <Input type="textarea" v-model="entitysave.note" :height="100" />
<span style="float:left">操作:&nbsp;</span>
<Dictionary ref="dicRadio" code="project.task.status" v-model="entitySave.status" type="radio"></Dictionary>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="8" v-if="entity.status==1"> <Col :span="12">
<FormItem label> <FormItem label="附件" prop="attachment">
<span style="float:left">工时:&nbsp;</span> <files ref="refFile" :parms="parms" files />
<InputNumber v-model="entitySave.workHour" :min="0"></InputNumber> </Input>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<FormItem>
<Button
type="primary"
@click="updatepart"
class="mr10"
>确定</Button
><Button @click="handleClose">取消</Button>
</FormItem>
</Form> </Form>
</div> </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" /> <component :is="detail" :eid="curId" />
</Card>
</div>
</div> </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>
</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: {
app: "taskRecord",
eid: null,
name: "",
field: "",
},
status: null,
entitysave: {
projectId: "",
planId: "",
workHour: 0,
title: "",
note: "",
attachment: "",
taskId: "",
},
timeValue: { timeValue: {
startDate: "", startDate: "",
endDate: "", endDate: "",
...@@ -104,156 +124,93 @@ export default { ...@@ -104,156 +124,93 @@ export default {
startDate: "", startDate: "",
endDate: "", endDate: "",
}, },
divHeight: '200px', divHeight: "200px",
rules: { rules: {
name: [{ title: [
{
required: true, required: true,
message: '必填', message: "必填",
trigger: 'blur' trigger: "blur",
}], },
code: [{ ],
workHour: [
{
required: true, required: true,
message: '必填', message: "必填",
trigger: 'blur' trigger: "blur",
}] },
],
}, },
detail: null, detail: null,
curId: '', curId: "",
newStatusList: [], };
}
}, },
props: { props: {
eid: String eid: String,
},
created() {
this.divHeight = window.innerHeight - 150 + 'px'
}, },
created() {},
mounted() { mounted() {
if (this.eid != '' && this.eid != null) { if (this.eid) {
this.load(this.eid); this.load(this.eid);
} }
window.onresize = () => {
return (() => {
this.divHeight = window.innerHeight - 150 + 'px'
})()
}
}, },
methods: { methods: {
load(v) { load(v) {
Api.get({ Api.get({
id: v id: v,
}).then(r => { }).then((r) => {
this.entity = r.result; this.entity = r.result;
this.timeValue = { this.status = this.entity.status;
startDate: r.result.startDate, this.entitysave.projectId = this.entity.projectId;
endDate: r.result.endDate, this.entitysave.planId = this.entity.planId;
}; this.entitysave.taskId = this.eid;
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 //控制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() { updatepart() {
if (this.entitySave.status != this.entity.status) { if (this.status != this.entity.status) {
let params = { let params = {
id: this.eid, id: this.eid,
status: this.entitySave.status status: this.status,
} };
if (this.entitySave.status == 1) { Api.updatepart(params).then((r) => {
params.startDate = ''
}
if (this.entitySave.status == 2) {
params.endDate = ''
}
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");
} else {
this.$Message.error('操作失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('操作失败')
console.warn(err)
})
} else { } else {
this.handleClose() this.$Message.error("操作失败");
}
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) => { ApiRecord.create(this.entitysave)
this.disabled = false; .then((res) => {
if (res.success) { if (res.success) {
this.$Message.success('保存工时成功') this.$Message.success("工时汇报成功");
this.$emit('on-ok') this.$emit("on-ok");
} else { } else {
this.$Message.error('保存失败') this.$Message.error("保存失败");
} }
}).catch(err => {
this.$Message.error('保存失败')
}) })
}
}, },
handleClose() { handleClose() {
this.$emit('on-close') this.$emit("on-close");
}, },
l(key) { l(key) {
key = "project_task" + "." + key; key = "project_task" + "." + key;
return this.$t(key) return this.$t(key);
} },
}, },
watch: { watch: {
eid(v) { eid(v) {
if (v != '' && v != null) { if (v) {
this.load(v); this.load(v);
} }
} },
} },
} };
</script> </script>
<style scoped> <style scoped>
...@@ -265,6 +222,5 @@ export default { ...@@ -265,6 +222,5 @@ export default {
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