Commit 8f3deafa authored by renjintao's avatar renjintao

opration record task

parent c44f2790
......@@ -1122,7 +1122,7 @@ html [type=button] {
a.remove,
a.delete {
color: #FF7A8B;
i:hover {
background: #FF7A8B;
color: #fff;
......
<template>
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end">
<Tooltip trigger="hover" v-if="!disable&&title" :content="titles" placement="top-end">
<a class="op" :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<Icon v-if="type=='icon'" :type="icon" :color="colors" />
<span v-else="type=='text'" v-text="text"></span>
</slot>
</a>
</Tooltip>
<a class="op" v-else :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<Icon v-if="type=='icon'" :type="icon" :color="colors" />
<span v-else="type=='text'" v-text="text"></span>
</slot>
</a>
......@@ -38,12 +38,18 @@ export default {
},
color: {
type: String
},
disable: {
type: Boolean,
default: false
}
},
data() {
return {
text: "",
css: "detail"
css: "detail",
colors: this.color,
titles: this.title
};
},
created() {
......@@ -63,22 +69,57 @@ export default {
} else if (this.type == "icon") {
this.css = "icon";
}
},
mounted() {
if (this.disable) {
this.colors = "#ccc";
this.titles = ''
}
},
methods: {
handler() {
if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({
title: this.title,
content: "<p>" + this.msg + "</p>",
onOk: () => {
this.$emit("click", event);
}
});
} else {
this.$emit("click", event);
if (!this.disable) {
if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({
title: this.title,
content: "<p>" + this.msg + "</p>",
onOk: () => {
this.$emit("click", event);
}
});
} else {
this.$emit("click", event);
}
}
}
}
},
watch: {
v() {},
disable(v) {
if (v) {
this.colors = "#ccc";
this.titles = '';
} else {
this.colors = this.color;
this.titles = this.title;
}
this.disable = v
},
color(v) {
if (v && v != '') {
this.colors = v
}
},
title(v) {
if (v && v != '') {
this.titles = v
}
},
},
};
</script>
......
......@@ -524,9 +524,7 @@ henq.makeRules = (list, apiUrl) => {
required: true,
trigger: "blur"
}
}
else if (el.ruleType == 'datetime')
{
} else if (el.ruleType == 'datetime') {
objInfo = {
required: true,
message: "请选择时间",
......@@ -552,4 +550,62 @@ henq.makeRules = (list, apiUrl) => {
return rules
}
//colums验证end
//获取当天、明天、昨天、本周、上周、本月、上月的日期 start
//获取今天的日期
henq.getToday = () => {
let myDate = new Date();
let nowDate = myDate.getFullYear() + "-" + (myDate.getMonth() + 1) + "-" + myDate.getDate();
return nowDate
}
//获取明天的日期
henq.getTomorrow = () => {
let myDate = new Date();
myDate.setTime(myDate.getTime() + 24 * 60 * 60 * 1000);
let tomorrowDate =
myDate.getFullYear() +
"-" +
(myDate.getMonth() + 1) +
"-" +
myDate.getDate();
return tomorrowDate
}
//获取昨天的日期
henq.getYestoday = () => {
let myDate = new Date();
myDate.setTime(myDate.getTime() - 24 * 60 * 60 * 1000);
let yestoayDate =
myDate.getFullYear() +
"-" +
(myDate.getMonth() + 1) +
"-" +
myDate.getDate();
return yestoayDate
}
//获取本周的日期
henq.getCurMonday = (val) => {
let nowTemp = new Date(); //当前时间
let oneDayLong = 24 * 60 * 60 * 1000; //一天的毫秒数
let c_time = nowTemp.getTime(); //当前时间的毫秒时间
let c_day = nowTemp.getDay() || 7; //当前时间的星期几
let m_time = c_time - (c_day - val) * oneDayLong; //当前周一的毫秒时间
let monday = new Date(m_time); //设置周一时间对象
let m_year = monday.getFullYear();
let m_month = monday.getMonth() + 1;
let m_date = monday.getDate();
return m_year + '-' + m_month + '-' + m_date
}
henq.getCurMonth = (val) => {
let nowTemp = new Date(); //当前时间
let m_year = nowTemp.getFullYear();
let m_month = nowTemp.getMonth() + 1+val;
if(m_month==0)
{
m_month=12
m_year=m_year-1
}
return m_year + '-' + m_month
}
//获取当天、明天、昨天、本周、上周、本月、上月的日期 end
export default henq;
......@@ -4,7 +4,7 @@
<Form ref="formInline" :model="easySearch" inline>
<FormItem>
<div class="taskMenu">
<Menu mode="horizontal" active-name="2">
<Menu mode="horizontal" active-name="1" @on-select="onSelectTime">
<MenuItem name="1">
所有
</MenuItem>
......@@ -40,23 +40,23 @@
</div>
</FormItem>
<FormItem style="float:right">
<Button type="primary" @click="add">新增记录</Button>
<Button type="primary" @click="add" v-if="false">新增记录</Button>
</FormItem>
</Form>
</div>
<div>
<div class="group">
<Row>
<Col span="3">
<Col span="4">
<div class="fr boxBoder">
<List>
<ListItem>
<ListItemMeta>
<template slot="title">
<h3>今天</h3>
<h3>{{listTitle}}</h3>
</template>
<template slot="description">
2020-10-20
{{listTime}}
</template>
</ListItemMeta>
<template slot="action">
......@@ -71,7 +71,7 @@
<Col span="2">
<Divider class="dividerpram" />
</Col>
<Col span="19">
<Col span="18">
<div class="boxBoder">
<Timeline v-if="recordList&&recordList.length>0">
<TimelineItem v-for="(item,index) in recordList" :key="index" v-if="recordList&&recordList.length>0">
......@@ -283,6 +283,8 @@ export default {
name: "",
field: "",
},
listTitle: '所有',
listTime: '截止当前:' + this.$u.getToday()
}
},
mounted() {
......@@ -363,6 +365,42 @@ export default {
this.parms.eid = val;
this.modalFiles = true;
},
onSelectTime(name) {
let title = '所有';
let time = '截止当前:' + this.$u.getToday();
switch (name) {
case '2':
title = '今天';
time = this.$u.getToday();
break;
case '3':
title = '昨天';
time = this.$u.getYestoday();
break;
case '4':
title = '本周';
time = this.$u.getCurMonday(1) + "--" + this.$u.getToday();
break;
case '5':
title = '上周';
time = this.$u.getCurMonday(-6) + "--" + this.$u.getCurMonday(0);
break;
case '6':
title = '本月';
time = this.$u.getCurMonth(0);
break;
case '7':
title = '上月';
time = this.$u.getCurMonth(-1);
break;
default:
title = '所有';
time = '截止当前:' + this.$u.getToday();
break;
}
this.listTitle = title;
this.listTime = time;
},
l(key) {
let vkey = "project_plan_record" + "." + key;
return this.$t(vkey) || key
......
import Api from '@/plugins/request'
export default {
index:`${material}/projecttask/paged`,
paged(params){
return Api.post(`${material}/projecttask/paged`,params);
},
get(params){
return Api.get(`${material}/projecttask/get`,params);
},
create(params){
return Api.post(`${material}/projecttask/create`,params);
},
update(params){
return Api.post(`${material}/projecttask/update`,params);
},
delete(id) {
return Api.delete(`${material}/projecttask/delete`,{params:{id:id}});
},
deletes(params) {
return Api.post(`${material}/projecttask/batchdelete`,params);
},
//改变状态
updatestatus(params) {
return Api.post(`${material}/projecttask/updatestatus`,params);
}
}
\ No newline at end of file
index: `${material}/projecttask/paged`,
paged(params) {
return Api.post(`${material}/projecttask/paged`, params);
},
get(params) {
return Api.get(`${material}/projecttask/get`, params);
},
create(params) {
return Api.post(`${material}/projecttask/create`, params);
},
update(params) {
return Api.post(`${material}/projecttask/update`, params);
},
delete(id) {
return Api.delete(`${material}/projecttask/delete`, {
params: {
id: id
}
});
},
deletes(params) {
return Api.post(`${material}/projecttask/batchdelete`, params);
},
//改变状态
updatestatus(params) {
return Api.post(`${material}/projecttask/updatestatus`, params);
},
//修改字段
updatepart(params) {
return Api.post(`${material}/projecttask/updatepart`, params);
}
}
\ No newline at end of file
......@@ -227,50 +227,54 @@ export default {
align: 'center',
render: (h, params) => {
return h('div', {
class: "action"
class: "action actionCur"
}, [
h('op', {
attrs: {
icon: "ios-play",
type: "icon",
title: params.row.status == 0 ? "开始" : params.row.status == 2 ? "继续" : '无法操作',
color: params.row.status == 0 || params.row.status == 2 ? "#19be6b" : '#ccc',
title: params.row.status == 0 ? "开始" : params.row.status == 2 ? "继续" : '',
color: "#19be6b",
disable: (params.row.status == 0 || params.row.status == 2) ? false : true
},
on: {
click: () => params.row.status == 0 || params.row.status == 2 ? this.updatestatus(params.row.id, 1) : null
click: () => this.updatepart(params.row.id, 1)
}
}),
h('op', {
attrs: {
icon: "ios-pause",
type: "icon",
title: params.row.status == 1 ? "暂停" : "无法操作",
color: params.row.status == 1 ? "#19be6b" : "#ccc",
title: "暂停",
color: "#19be6b",
disable: params.row.status == 1 ? false : true
},
on: {
click: () => params.row.status == 1 ? this.updatestatus(params.row.id, 2) : null
click: () => this.updatepart(params.row.id, 2)
}
}),
h('op', {
attrs: {
icon: "ios-close",
icon: "md-checkbox-outline",
type: "icon",
title: params.row.status != 0 ? "完成" : "无法操作",
color: params.row.status != 0 ? "#19be6b" : "#ccc",
title: "完成",
color: "#19be6b",
disable: (params.row.status != 0 && params.row.status != 3) ? false : true
},
on: {
click: () => params.row.status != 0 ? this.updatestatus(params.row.id, 3) : null
click: () => this.updatepart(params.row.id, 3)
}
}),
h('op', {
attrs: {
icon: "md-add",
type: "icon",
title: params.row.status != 3 ? "新增记录" : "无法操作",
color: params.row.status != 3 ? "#19be6b" : "#ccc",
title: "新增记录",
color: "#19be6b",
disable: (params.row.status != 3 && params.row.status != 4) ? false : true
},
on: {
click: () => params.row.status != 0 ? this.addRecord(params.row.id) : null
click: () => this.addRecord(params.row.id)
}
}),
h('op', {
......@@ -279,6 +283,7 @@ export default {
type: "icon",
title: "修改",
color: "#2b85e4",
disable: (params.row.status == 0 || params.row.status == 2) ? false : true
},
on: {
click: () => this.edit(params.row.id)
......@@ -289,7 +294,9 @@ export default {
icon: "ios-trash-outline",
type: "icon",
title: "删除",
oprate: 'delete',
color: "#ed4014",
disable: (params.row.status == 0 || params.row.status == 3) ? false : true
},
on: {
click: () => this.remove(params.row.id)
......@@ -405,13 +412,12 @@ export default {
};
this.$refs.grid.reload(where);
},
updatestatus(valId, valStatus) {
updatepart(valId, valStatus) {
let params = {
id: valId,
status: valStatus,
detail: ''
}
Api.updatestatus(params).then(r => {
Api.updatepart(params).then(r => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success('操作成功')
......@@ -485,4 +491,19 @@ export default {
}
}
}
.actionCur {
a {
span {
padding: 4px;
}
i {
padding: 4px;
border-radius: 3px;
font-weight: bold;
font-size: 18px;
}
}
}
</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