Commit 3e8bc86e authored by renjintao's avatar renjintao

outputtime

parent 1ff0d1f2
......@@ -529,6 +529,17 @@ export default {
});
};
}
if(u.type=="outputTime")
{
u.render = (h, params) => {
let values = u.key;
return h("OutputTime", {
props: {
value: params.row[values]
}
});
};
}
return !u.hide;
});
return cols;
......
<template>
<div style="padding-top:5px">{{name}}</div>
</template>
<script>
export default {
name: "outputTime",
data() {
return {
name: "",
item: {},
items: [],
data: []
};
},
props: {
value: {
type: [String, Number],
required: false
}
},
created() {},
mounted() {
this.setName();
},
methods: {
setName() {
this.name = this.secondsFormat(this.value);
},
secondsFormat(s) {
var day = Math.floor(s / (24 * 3600)); // Math.floor()向下取整
var hour = Math.floor((s - day * 24 * 3600) / 3600);
var minute = Math.floor((s - day * 24 * 3600 - hour * 3600) / 60);
var second = s - day * 24 * 3600 - hour * 3600 - minute * 60;
let outStr = "";
if (day) {
if (second == 0 && minute > 0 && hour > 0) {
outStr = day + "天" + hour + "时" + minute + "分";
} else if (second == 0 && minute == 0 && hour > 0) {
outStr = day + "天" + hour + "时";
} else if (second == 0 && minute == 0 && hour == 0) {
outStr = day + "天";
} else {
outStr = day + "天" + hour + "时" + minute + "分" + second + "秒";
}
return outStr;
} else {
if (hour) {
if (second == 0 && minute > 0) {
outStr = hour + "时" + minute + "分";
} else if (second == 0 && minute == 0) {
outStr = hour + "时";
} else {
outStr = hour + "时" + minute + "分" + second + "秒";
}
return outStr;
} else {
if (minute) {
if (second == 0) {
outStr = minute + "分";
} else {
outStr = minute + "分" + second + "秒";
}
return outStr;
} else {
if (second) {
return second + "秒";
}
}
// if (second < 10) {
// if (minute < 10) {
// return "0" + minute + ":" + second + "0";
// } else {
// return minute + ":" + second + "0";
// }
// } else {
// return minute + ":" + second;
// }
}
}
}
},
computed: {},
watch: {
value(v) {
if (v > 0) this.setName();
}
}
};
</script>
\ No newline at end of file
......@@ -13,14 +13,14 @@
<Filed :span="12" :name="l('isImportantResources')">
<state code="Process.state" :value="entity.isImportantResources" type="text"></state>
</Filed>
<Filed :span="12" :name="l('schedulingWorkingHours')">{{entity.schedulingWorkingHours}}</Filed>
<Filed :span="12" :name="l('runtime')">{{entity.runtime}}</Filed>
<Filed :span="12" :name="l('realRuntime')">{{entity.realRuntime}}</Filed>
<Filed :span="12" :name="l('realWorkingHours')">{{entity.realWorkingHours}}</Filed>
<Filed :span="12" :name="l('schedulingWorkingHours')"><OutputTime :value="entity.schedulingWorkingHours"></OutputTime></Filed>
<Filed :span="12" :name="l('runtime')"><OutputTime :value="entity.runtime"></OutputTime></Filed>
<Filed :span="12" :name="l('realRuntime')"><OutputTime :value="entity.realRuntime"></OutputTime></Filed>
<Filed :span="12" :name="l('realWorkingHours')"><OutputTime :value="entity.realWorkingHours"></OutputTime></Filed>
<Filed :span="12" :name="l('isOutside')">
<state code="Process.state" :value="entity.isOutside" type="text"></state>
</Filed>
<Filed :span="12" :name="l('outsideTime')">{{entity.outsideTime}}</Filed>
<Filed :span="12" :name="l('outsideTime')"><OutputTime :value="entity.outsideTime"></OutputTime></Filed>
<Filed :span="12" :name="l('isParticipateIntime')">
<state code="Process.state" :value="entity.isParticipateIntime" type="text"></state>
</Filed>
......
......@@ -94,7 +94,7 @@ export default {
key: "resourceCode",
title: this.l("resourceCode"),
align: "left",
easy: true,
easy: true
},
{
key: "isImportantResources",
......@@ -106,19 +106,27 @@ export default {
{
key: "schedulingWorkingHours",
title: this.l("schedulingWorkingHours"),
align: "right"
align: "right",
type: "outputTime",
},
{ key: "runtime", title: this.l("runtime"), align: "right" },
{
key: "runtime",
title: this.l("runtime"),
align: "right",
type: "outputTime",
},
{
key: "realRuntime",
title: this.l("realRuntime"),
align: "right"
align: "right",
type: "outputTime",
},
{
key: "outsideTime",
title: this.l("outsideTime"),
align: "right"
align: "right",
type: "outputTime",
},
{
......@@ -277,7 +285,12 @@ export default {
{
attrs: { oprate: "detail" },
on: {
click: () => this.addStep(params.row.id, params.row.name,params.row.maxNumStep)
click: () =>
this.addStep(
params.row.id,
params.row.name,
params.row.maxNumStep
)
}
},
"新增"
......@@ -313,7 +326,7 @@ export default {
],
list: [],
maxNum: 0,
maxNumTemp:0,
maxNumTemp: 0
};
},
created() {
......@@ -322,7 +335,7 @@ export default {
} else {
this.easySearch.routingHeaderId.value = this.$route.query.id;
}
this.hid =Number(this.easySearch.routingHeaderId.value);
this.hid = Number(this.easySearch.routingHeaderId.value);
},
mounted() {
this.load();
......@@ -385,7 +398,7 @@ export default {
},
add() {
this.curId = 0;
this.maxNum=this.maxNumTemp
this.maxNum = this.maxNumTemp;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
......@@ -420,10 +433,10 @@ export default {
this.curId = 0;
this.modal = false;
},
addStep(detailId, detailName,detailMaxNumStep) {
addStep(detailId, detailName, detailMaxNumStep) {
this.curId = detailId;
this.curName = detailName;
this.maxNum=detailMaxNumStep;
this.maxNum = detailMaxNumStep;
this.title = "新增工步";
this.detail = () => import("./routingStep/add");
this.modal = true;
......
......@@ -46,6 +46,7 @@ import ProductSelect from '@/components/page/productSelect.vue'
import DTSpan from '@/components/page/dtSpan.vue'
import DTSearch from '@/components/page/dtSearch.vue'
import InputTime from '@/components/page/inputTime.vue'
import OutputTime from '@/components/page/outputTime.vue'
// import FormMaking from 'form-making'
// import 'form-making/dist/FormMaking.css'
......@@ -98,6 +99,7 @@ Vue.component("ProductSelect", ProductSelect)
Vue.component("DTSpan", DTSpan)
Vue.component("DTSearch", DTSearch)
Vue.component("InputTime", InputTime)
Vue.component("OutputTime", OutputTime)
//注入mock
// require("../mock")
......
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