Commit 8f3deafa authored by renjintao's avatar renjintao

opration record task

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