Commit eeb2b3f1 authored by renjintao's avatar renjintao

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

parents 6aa70c58 0685f966
<template> <template>
<div class="time-view" v-if="timeValue.startDate && timeValue.endDate"> <div class="time-view">
<div>{{ timeValue.startDate }}</div> <div>{{ startDate }}</div>
<div class="jian-tou"> <div class="jian-tou" v-if="startDate && endDate">
<div>{{ date }}</div> <div>{{ jg }} {{ unit }}</div>
</div> </div>
<div>{{ timeValue.endDate }}</div> <div>{{ endDate }}</div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "", name: "",
data() { data() {
return {}; return {
startDate: null,
endDate: null,
unit: "h",
jg: 0,
};
}, },
props: { props: {
// model: { value: Object,
// prop: "value", start: {
// event: "on-change", type: String,
// }, default: "startDate",
},
end: {
type: String,
default: "endDate",
},
mode: {
type: String,
default: "h", //h:小时,d:天,w:周,m:月
},
timeValue: { timeValue: {
type: [String, Object], type: [String, Object],
default: "", default: "",
}, },
work: { work: {
type: [String, Number], //传入的work为0,转换为小时,1为天,2为周,3为月 type: [String, Number], //传入的work为0,转换为小时,1为天,2为周,3为月
default: 0, default: 8,
}, },
}, },
computed: {
date() {
var date1 = new Date(this.timeValue.startDate).getTime(); //开始时间,时间戳
var date2 = new Date(this.timeValue.endDate).getTime(); //结束时间,时间戳
var date3 = 0;
date3 = date2 - date1;
// var timeSpanStr; mounted() {
// if (date3 <= 1000 * 60 * 1) { this.init();
// timeSpanStr = "刚刚"; },
// } else if (1000 * 60 * 1 < date3 && date3 <= 1000 * 60 * 60) { methods: {
// timeSpanStr = Math.round(date3 / (1000 * 60)) + "分钟"; init(v) {
// } else if (1000 * 60 * 60 * 1 < date3 && date3 <= 1000 * 60 * 60 * 24) { this.startDate = v[this.start];
// timeSpanStr = Math.round(date3 / (1000 * 60 * 60)) + "小时"; this.endDate = v[this.end];
// } else if (
// 1000 * 60 * 60 * 24 < this.unit = this.mode;
// date3 var date1 = new Date(this.startDate).getTime(); //开始时间,时间戳
// // && date3 <= 1000 * 60 * 60 * 24 * 30 var date2 = new Date(this.endDate).getTime(); //结束时间,时间戳
// ) {
// timeSpanStr = Math.round(date3 / (1000 * 60 * 60 * 24)) + "天";
// }
// return timeSpanStr;
this.jg = date2 - date1;
var result = ""; var result = "";
var minute = 1000 * 60; var minute = 1000 * 60;
var hour = minute * 60; var hour = minute * 60;
var day = hour * 24; var day = hour * 24;
var month = day * 30; var month = day * 30;
if (date3 < 0) return; if (this.jg < 0) return;
var monthC = date3 / month; var monthC = this.jg / month;
var weekC = date3 / (7 * day); var weekC = this.jg / (7 * day);
var dayC = date3 / day; var dayC = this.jg / day;
var hourC = date3 / hour; var hourC = this.jg / hour;
var minC = date3 / minute; var minC = this.jg / minute;
if (this.work == 3) { if (this.unit == "m") {
result = "" + parseInt(monthC) + "月"; result = "" + parseInt(monthC);
} else if (this.work == 2) { } else if (this.unit == "w") {
result = "" + parseInt(weekC) + "周"; result = "" + parseInt(weekC);
} else if (this.work == 1) { } else if (this.unit == "d") {
result = "" + parseInt(dayC) + "天"; result = "" + parseInt(dayC);
} else if (this.work == 0) { } else if (this.unit == "h") {
result = "" + parseInt(hourC) + " h"; result = "" + parseInt(hourC);
}
// if (monthC >= 1) {
// result = "" + parseInt(monthC) + "月";
// } else if (weekC >= 1) {
// result = "" + parseInt(weekC) + "周";
// } else if (dayC >= 1) {
// result = "" + parseInt(dayC) + "天";
// } else if (hourC >= 1) {
// result = "" + parseInt(hourC) + "小时";
// }
// else if (minC >= 1) {
// result = "" + parseInt(minC) + "分钟";
// }
else {
result = "0";
} }
return result; this.jg = result;
},
},
watch: {
value: {
handler: function (n, v) {
this.init(n);
},
deep: true,
}, },
}, },
mounted() {},
methods: {},
watch: {},
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<Modal <Modal
v-model="modal" v-model="modal"
title="生命周期" title="生命周期"
width="800" width="1200"
footer-hide footer-hide
:mask-closable="false" :mask-closable="false"
> >
......
...@@ -146,6 +146,9 @@ export default { ...@@ -146,6 +146,9 @@ export default {
align: "left", align: "left",
high: true, high: true,
code: "mes.project_plan.Type", code: "mes.project_plan.Type",
attr:{
type:'icon'
}
}, },
{ {
key: "title", key: "title",
...@@ -162,14 +165,21 @@ export default { ...@@ -162,14 +165,21 @@ export default {
high: true, high: true,
code: "mes.project_plan.Status", code: "mes.project_plan.Status",
}, },
{ // {
key: "startDate", // key: "startDate",
title: this.l("startDate"), // title: this.l("startDate"),
align: "left", // align: "left",
high: true // high: true
,type:"date" // ,type:"date"
}, // },
{ key: "endDate", title: this.l("endDate"), align: "left", high: true,type:"date" }, // { key: "endDate", title: this.l("endDate"), align: "left", high: true,type:"date" },
{ key: "endDate", title: "计划日期", align: "left",render(h,param) {
return h('DateRange',{
attrs:{
value:param.row
}
})
}, },
// { // {
// key: "attachment", // key: "attachment",
// title: this.l("attachment"), // title: this.l("attachment"),
......
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