Commit a4d2c6db authored by 周远喜's avatar 周远喜

ok

parent 3488f24a
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
}, },
value: { value: {
type: String, type: String,
default: '2001-01-01 00:00:00' default: ''
}, },
}, },
created() { created() {
......
<template> <template>
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end"> <Tooltip trigger="hover" v-if="title" :content="title" 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="color" />
<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="color" />
<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>
export default { 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: {
type: String
}
}, },
data() { color: {
return { type: String,
text: "",
css: "detail"
};
}, },
created() { disalbed: {
var oprates = { // 0 启用 1 禁用 2权限不足
detail: "查看", type: Number,
edit: "编辑", default: 0,
add: "添加", },
delete: "删除", },
remove: "删除" data() {
}; return {
text: "",
css: "detail",
};
},
created() {
var oprates = {
detail: "查看",
edit: "编辑",
add: "添加",
delete: "删除",
remove: "删除",
};
if (oprates[this.oprate]) { if (oprates[this.oprate]) {
this.text = oprates[this.oprate]; this.text = oprates[this.oprate];
this.css = this.oprate; this.css = this.oprate;
} else if (this.oprate) { } else if (this.oprate) {
this.css = this.oprate; this.css = this.oprate;
} else if (this.type == "icon") { } else if (this.type == "icon") {
this.css = "icon"; this.css = "icon";
}
},
methods: {
handler() {
if (this.disalbed == 0) {
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);
} }
}else if(this.disabled==1){
this.$Message.info("不能操作")
}else{
this.$Message.info("没有权限")
}
}, },
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);
}
}
}
}; };
</script> </script>
<style lang="less"> <style lang="less">
a.op { a.op {
display: inline; display: inline;
margin: 0 3px; margin: 0 3px;
} }
</style> </style>
<template> <template>
<Layout class="full"> <Layout class="full">
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300"> <Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<ProductTree @on-hide="onHide" @on-select="productSearch" /> <ProductTree @on-hide="onHide" @on-select="productSearch" />
</Sider> </Sider>
<div v-if="!showMenu" class="show_menu"> <div v-if="!showMenu" class="show_menu">
<a class="menu_play fr" @click="showMenuFn" title="展开"> <a class="menu_play fr" @click="showMenuFn" title="展开">
<Icon type="ios-arrow-forward" size="24" /> <Icon type="ios-arrow-forward" size="24" />
</a> </a>
</div> </div>
<Content class="content" :class="!showMenu?'con_bord':''"> <Content class="content" :class="!showMenu ? 'con_bord' : ''">
<DataGrid :columns="columns" ref="grid" :action="action"> <DataGrid :columns="columns" ref="grid" :action="action">
<template slot="easySearch"> <template slot="easySearch">
<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" @on-select="onSelect"> <Menu mode="horizontal" active-name="2" @on-select="onSelect">
<MenuItem name="1"> <MenuItem name="1"> 所有 </MenuItem>
所有 <MenuItem name="2"> 未关闭 </MenuItem>
</MenuItem> <MenuItem name="3"> 指派给我 </MenuItem>
<MenuItem name="2"> <MenuItem name="4"> 由我参与 </MenuItem>
未关闭 <MenuItem name="5"> 已延期 </MenuItem>
</MenuItem> <Submenu name="6">
<MenuItem name="3"> <template slot="title"> 更多 </template>
指派给我 <MenuGroup title="更多">
</MenuItem> <MenuItem name="6-1">状态1</MenuItem>
<MenuItem name="4"> <MenuItem name="6-2">状态2</MenuItem>
由我参与 <MenuItem name="6-3">状态3</MenuItem>
</MenuItem> </MenuGroup>
<MenuItem name="5"> </Submenu>
已延期 </Menu>
</MenuItem> </div>
<Submenu name="6"> <div class="taskTab" v-if="false">
<template slot="title"> <Tabs value="statu2">
更多 <TabPane label="所有" name="statu1" />
</template> <TabPane label="未关闭" name="statu2" />
<MenuGroup title="更多"> <TabPane label="指派给我" name="statu3" />
<MenuItem name="6-1">状态1</MenuItem> <TabPane label="由我参与" name="statu4" />
<MenuItem name="6-2">状态2</MenuItem> <TabPane label="已延期" name="statu5" />
<MenuItem name="6-3">状态3</MenuItem> </Tabs>
</MenuGroup> </div>
</Submenu> </FormItem>
</Menu> <FormItem prop="keys"
</div> ><Input
<div class="taskTab" v-if="false"> placeholder="请输入项目标题/计划名称/任务标题"
<Tabs value="statu2"> v-model="easySearch.keys.value"
<TabPane label="所有" name="statu1" /> v-width="240"
<TabPane label="未关闭" name="statu2" /> />
<TabPane label="指派给我" name="statu3" /> </FormItem>
<TabPane label="由我参与" name="statu4" /> <FormItem
<TabPane label="已延期" name="statu5" /> ><Button type="primary" @click="search">查询</Button></FormItem
</Tabs> >
</div> <FormItem>
</FormItem> <Button @click="highSearch" type="text">
<FormItem prop="keys"><Input placeholder="请输入项目标题/计划名称/任务标题" v-model="easySearch.keys.value" v-width="240" /> </FormItem> <Icon type="md-search" />高级
<FormItem><Button type="primary" @click="search">查询</Button></FormItem> </Button>
<FormItem> </FormItem>
<Button @click="highSearch" type="text"> </Form>
<Icon type="md-search" />高级 </template>
</Button> <template slot="buttons">
</FormItem> <Button type="primary" @click="add">新增</Button>
</Form> </template>
</template> <template slot="batch">
<template slot="buttons"> <Button type="primary" class="mr10 ml10">开始</Button>
<Button type="primary" @click="add">新增</Button> <Button type="primary" class="mr10 ml10">暂停</Button>
</template> <Button type="primary" class="mr10 ml10">继续</Button>
<template slot="batch"> </template>
<Button type="primary" class="mr10 ml10">开始</Button> </DataGrid>
<Button type="primary" class="mr10 ml10">暂停</Button> <Modal
<Button type="primary" class="mr10 ml10">继续</Button> v-model="modal"
</template> :title="title"
</DataGrid> width="1200"
<Modal v-model="modal" :title="title" width="1200" :fullscreen="fullScreen" footer-hide> :fullscreen="fullScreen"
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" /> footer-hide
</Modal> >
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</Content> </Content>
</Layout> </Layout>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
import Search from './search' import Search from "./search";
import ProductTree from "@/components/page/productTree.vue"; import ProductTree from "@/components/page/productTree.vue";
export default { export default {
name: 'list', name: "list",
components: { components: {
Search, Search,
ProductTree ProductTree,
}, },
head: { head: {
title: "", title: "",
author: "henq", author: "henq",
description: "project_task 10/20/2020 9:27:58 AM", description: "project_task 10/20/2020 9:27:58 AM",
}, },
data() { data() {
return { return {
action: Api.index, action: Api.index,
showMenu: true, showMenu: true,
easySearch: { easySearch: {
keys: { keys: {
op: "title,projectTitle,planTitle", op: "title,projectTitle,planTitle",
value: null value: null,
}
},
theme1: 'light',
modal: false,
title: "新增",
detail: null,
curId: '',
fullScreen: false,
columns: [
// {
// key: "selection",
// type: "selection",
// width: 50,
// align: "center"
// },
{
key: "id",
title: this.$t("id"),
align: "left",
high: true
},
{
key: "title",
title: this.l("title"),
align: "left",
easy: true,
high: true,
render: (h, params) => {
return h('a', {
attrs: {
oprate: 'detail'
},
on: {
click: () => this.viewRecord(params.row.id)
}
}, params.row.title)
}
},
{
key: "level",
title: this.l("level"),
align: "center",
high: true,
code: 'project.task.level'
},
{
key: "projectTitle",
title: this.l("projectTitle"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "planTitle",
title: this.l("planTitle"),
align: "left",
easy: true,
high: true,
hide: true,
},
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
code: 'project.task.status'
},
{
key: "userId",
title: this.l("userId"),
align: "left",
high: true,
type: 'user'
},
{
key: "startDate",
title: this.l("startDate"),
align: "center",
high: true,
},
{
key: "endDate",
title: this.l("endDate"),
align: "center",
high: true,
},
{
key: "note",
title: this.l("note"),
align: "left",
high: true,
hide: true
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
high: true,
hide: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
hide: true,
type: 'user'
},
{
title: '操作',
key: 'action',
width: 200,
align: 'center',
render: (h, params) => {
return h('div', {
class: "action"
}, [
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',
},
on: {
click: () => params.row.status == 0 || params.row.status == 2 ? this.updatestatus(params.row.id, 1) : null
}
}),
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-close",
type: "icon",
title: params.row.status != 0 ? "完成" : "无法操作",
color: params.row.status != 0 ? "#19be6b" : "#ccc",
},
on: {
click: () => params.row.status != 0 ? this.updatestatus(params.row.id, 3) : null
}
}),
h('op', {
attrs: {
icon: "md-add",
type: "icon",
title: params.row.status != 3 ? "新增记录" : "无法操作",
color: params.row.status != 3 ? "#19be6b" : "#ccc",
},
on: {
click: () => params.row.status != 0 ? this.addRecord(params.row.id) : null
}
}),
h('op', {
attrs: {
icon: "ios-create-outline",
type: "icon",
title: "修改",
color: "#2b85e4",
},
on: {
click: () => this.edit(params.row.id)
}
}),
h('op', {
attrs: {
icon: "ios-trash-outline",
type: "icon",
title: "删除",
color: "#ed4014",
},
on: {
click: () => this.remove(params.row.id)
}
})
])
}
},
],
data1: [{
id: 1,
title: '测试title'
}]
}
},
mounted() {
console.log(this);
},
async fetch({
store,
params
}) {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load()
this.modal = false
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch)
}, },
add() { },
this.curId = 0; theme1: "light",
this.title = "新增"; modal: false,
this.fullScreen = false; title: "新增",
this.detail = () => import('./add') detail: null,
this.modal = true; curId: "",
fullScreen: false,
columns: [
// {
// key: "selection",
// type: "selection",
// width: 50,
// align: "center"
// },
{
key: "id",
title: this.$t("id"),
align: "left",
high: true,
}, },
highSearch() { {
this.curId = 0; key: "title",
this.title = "高级搜索"; title: this.l("title"),
this.fullScreen = false; align: "left",
this.detail = () => import('./search') easy: true,
this.modal = true; high: true,
render: (h, params) => {
return h(
"a",
{
attrs: {
oprate: "detail",
},
on: {
click: () => this.viewRecord(params.row.id),
},
},
params.row.title
);
},
}, },
copy(id) { {
this.curId = id; key: "level",
this.title = "克隆"; title: this.l("level"),
this.fullScreen = false; align: "center",
this.detail = () => import('./add') high: true,
this.modal = true; code: "project.task.level",
}, },
view(id) { {
this.curId = id; key: "projectTitle",
this.title = "详情"; title: this.l("projectTitle"),
this.fullScreen = false; align: "left",
this.detail = () => import('./detail') easy: true,
this.modal = true; high: true,
hide: true,
}, },
edit(id) { {
this.curId = id; key: "planTitle",
this.title = "编辑"; title: this.l("planTitle"),
this.fullScreen = false; align: "left",
this.detail = () => import('./edit') easy: true,
this.modal = true; high: true,
hide: true,
}, },
remove(id) { {
Api.delete(id).then((r) => { key: "status",
if (r.success) { title: this.l("status"),
this.$refs.grid.load(); align: "center",
this.$Message.success('删除成功') high: true,
} code: "project.task.status",
})
}, },
cancel() {
this.curId = 0; {
this.modal = false key: "userId",
title: this.l("userId"),
align: "left",
high: true,
type: "user",
}, },
onHide() { {
// this.$Message.info("收起左侧树") key: "startDate",
this.showMenu = false; title: this.l("startDate"),
align: "center",
high: true,
}, },
showMenuFn() { {
//this.$Message.info("展开左侧树") key: "endDate",
this.showMenu = true; title: this.l("endDate"),
align: "center",
high: true,
}, },
productSearch(id, item, productIds, ids) { {
let where = { key: "note",
bomId: { title: this.l("note"),
op: "In", align: "left",
value: ids high: true,
} hide: true,
};
this.$refs.grid.reload(where);
}, },
updatestatus(valId, valStatus) { {
let params = { key: "creationTime",
id: valId, title: this.l("creationTime"),
status: valStatus, align: "left",
detail: '' high: true,
} hide: true,
Api.updatestatus(params).then(r => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success('操作成功')
} else {
this.$Message.error('操作失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('操作失败')
console.warn(err)
})
}, },
onSelect(val) { {
this.$refs.grid.reload(this.easySearch) key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
hide: true,
type: "user",
}, },
viewRecord(id) { {
this.curId = id; title: "操作",
this.title = "查看记录"; key: "action",
this.fullScreen = true; width: 200,
this.detail = () => import('./detail') align: "center",
this.modal = true; render: (h, params) => {
return h(
"div",
{
class: "action",
},
[
h("op", {
attrs: {
icon: "ios-play",
type: "icon",
title:
params.row.status == 0
? "开始"
: params.row.status == 2
? "继续"
: "无法操作",
},
on: {
click: () =>
params.row.status == 0 || params.row.status == 2
? this.updatestatus(params.row.id, 1)
: null,
},
}),
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-close",
type: "icon",
title: "完成"
},
on: {
click: () =>
params.row.status != 0
? this.updatestatus(params.row.id, 3)
: null,
},
}),
h("op", {
attrs: {
icon: "md-add",
type: "icon",
title: "工时汇报",
},
on: {
click: () =>
params.row.status != 0
? this.addRecord(params.row.id)
: null,
},
}),
h("op", {
attrs: {
icon: "ios-create-outline",
type: "icon",
title: "修改",
},
on: {
click: () => this.edit(params.row.id),
},
}),
h("op", {
attrs: {
icon: "ios-trash-outline",
type: "icon",
title: "删除",
oprate: "delete",
msg: "确认要删除吗?",
},
on: {
click: () => this.remove(params.row.id),
},
}),
]
);
},
}, },
addRecord(id) { ],
this.curId = id; data1: [
this.title = "新增记录"; {
this.fullScreen = true; id: 1,
this.detail = () => import('../record/add') title: "测试title",
this.modal = true;
}, },
l(key) { ],
let vkey = "project_task" + "." + key; };
return this.$t(vkey) || key },
mounted() {
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.fullScreen = false;
this.detail = () => import("./add");
this.modal = true;
},
highSearch() {
this.curId = 0;
this.title = "高级搜索";
this.fullScreen = false;
this.detail = () => import("./search");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.fullScreen = false;
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.fullScreen = false;
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.fullScreen = false;
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
} }
} });
} },
cancel() {
this.curId = 0;
this.modal = false;
},
onHide() {
// this.$Message.info("收起左侧树")
this.showMenu = false;
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
productSearch(id, item, productIds, ids) {
let where = {
bomId: {
op: "In",
value: ids,
},
};
this.$refs.grid.reload(where);
},
updatestatus(valId, valStatus) {
let params = {
id: valId,
status: valStatus,
detail: "",
};
Api.updatestatus(params)
.then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("操作成功");
} else {
this.$Message.error("操作失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("操作失败");
console.warn(err);
});
},
onSelect(val) {
this.$refs.grid.reload(this.easySearch);
},
viewRecord(id) {
this.curId = id;
this.title = "查看记录";
this.fullScreen = true;
this.detail = () => import("./detail");
this.modal = true;
},
addRecord(id) {
this.curId = id;
this.title = "新增记录";
this.fullScreen = true;
this.detail = () => import("../record/add");
this.modal = true;
},
l(key) {
let vkey = "project_task" + "." + key;
return this.$t(vkey) || key;
},
},
};
</script> </script>
<style lang="less"> <style lang="less">
.full { .full {
margin-top: 0; margin-top: 0;
.content { .content {
margin-top: 10px; margin-top: 10px;
.ivu-icon-ios-add:before { .ivu-icon-ios-add:before {
content: "\f341"; content: "\f341";
} }
.ivu-icon-ios-remove:before { .ivu-icon-ios-remove:before {
content: "\f33d"; content: "\f33d";
}
} }
}
} }
.taskTab .ivu-tabs-bar { .taskTab .ivu-tabs-bar {
border-bottom: 1px solid #fff; border-bottom: 1px solid #fff;
margin-bottom: 2px; margin-bottom: 2px;
} }
.taskMenu { .taskMenu {
font-size: 12px; font-size: 12px;
.ivu-menu-horizontal { .ivu-menu-horizontal {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
} }
.ivu-menu-light { .ivu-menu-light {
&:after { &:after {
height: 0px !important; height: 0px !important;
}
} }
}
} }
</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