Commit 4e006a98 authored by 周远喜's avatar 周远喜

ok

parents 17c1eedb 0a699746
<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>
</template> </template>
<script> <script>
...@@ -20,35 +20,37 @@ export default { ...@@ -20,35 +20,37 @@ export default {
name: "op", name: "op",
props: { props: {
icon: { icon: {
type: String, type: String
}, },
oprate: { oprate: {
type: String, type: String
}, },
type: { type: {
type: String, type: String,
default: "text", default: "text"
}, },
title: { title: {
type: String, type: String,
}, },
msg: { msg: {
type: String, type: String,
default: "确认要删除吗?", default: "确认要删除吗?"
}, },
color: { color: {
type: String, type: String
}, },
disalbe: { disable: {
// 0 启用 1 禁用 2权限不足 type: Boolean,
type: Number, default: false
default: 0,
}, },
}, },
data() { data() {
return { return {
text: "", text: "",
css: "detail", css: "detail",
colors: this.color,
titles: this.title
}; };
}, },
created() { created() {
...@@ -57,7 +59,7 @@ export default { ...@@ -57,7 +59,7 @@ export default {
edit: "编辑", edit: "编辑",
add: "添加", add: "添加",
delete: "删除", delete: "删除",
remove: "删除", remove: "删除"
}; };
if (oprates[this.oprate]) { if (oprates[this.oprate]) {
...@@ -68,28 +70,54 @@ export default { ...@@ -68,28 +70,54 @@ export default {
} else if (this.type == "icon") { } else if (this.type == "icon") {
this.css = "icon"; this.css = "icon";
} }
if(this.disalbe){
this.css="disable" },
mounted() {
if (this.disable) {
this.colors = "#ccc";
this.titles = ''
} }
}, },
methods: { methods: {
handler() { handler() {
if (this.disalbe == 0) { if (!this.disable) {
if (this.oprate == "delete" || this.oprate == "remove") { if (this.oprate == "delete" || this.oprate == "remove") {
this.$Modal.confirm({ this.$Modal.confirm({
title: this.title, title: this.title,
content: "<p>" + this.msg + "</p>", content: "<p>" + this.msg + "</p>",
onOk: () => { onOk: () => {
this.$emit("click", event); this.$emit("click", event);
}, }
}); });
} else { } else {
this.$emit("click", event); this.$emit("click", event);
} }
}else if(this.disalbe==1){ }
this.$Message.warning("不能操作") }
}else{ },
this.$Message.warning("没有权限") 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
} }
}, },
}, },
......
...@@ -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: {
id: id
}
});
}, },
deletes(params) { deletes(params) {
return Api.post(`${material}/projecttask/batchdelete`,params); return Api.post(`${material}/projecttask/batchdelete`, params);
}, },
//改变状态 //改变状态
updatestatus(params) { updatestatus(params) {
return Api.post(`${material}/projecttask/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', {
attrs: {
icon: "ios-pause",
type: "icon",
title: params.row.status == 1 ? "暂停" : "无法操作",
color: params.row.status == 1 ? "#19be6b" : "#ccc",
},
on: {
click: () => params.row.status == 1 ? this.updatestatus(params.row.id, 2) : null
} }
}), }),
// h('op', {
// attrs: {
// icon: "ios-pause",
// type: "icon",
// title: "暂停",
// //color: "#19be6b",
// //disable: params.row.status == 1 ? false : true
// },
// on: {
// 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', {
...@@ -278,7 +282,8 @@ export default { ...@@ -278,7 +282,8 @@ export default {
icon: "ios-create-outline", icon: "ios-create-outline",
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: "删除",
color: "#ed4014", oprate: 'delete',
//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)
...@@ -485,4 +492,19 @@ export default { ...@@ -485,4 +492,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