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>
...@@ -20,30 +20,35 @@ export default { ...@@ -20,30 +20,35 @@ 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,
} },
disalbed: {
// 0 启用 1 禁用 2权限不足
type: Number,
default: 0,
},
}, },
data() { data() {
return { return {
text: "", text: "",
css: "detail" css: "detail",
}; };
}, },
created() { created() {
...@@ -52,7 +57,7 @@ export default { ...@@ -52,7 +57,7 @@ export default {
edit: "编辑", edit: "编辑",
add: "添加", add: "添加",
delete: "删除", delete: "删除",
remove: "删除" remove: "删除",
}; };
if (oprates[this.oprate]) { if (oprates[this.oprate]) {
...@@ -66,19 +71,25 @@ export default { ...@@ -66,19 +71,25 @@ export default {
}, },
methods: { methods: {
handler() { handler() {
if (this.disalbed == 0) {
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.disabled==1){
this.$Message.info("不能操作")
}else{
this.$Message.info("没有权限")
} }
} },
},
}; };
</script> </script>
......
<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>
...@@ -8,32 +8,20 @@ ...@@ -8,32 +8,20 @@
<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>
<MenuItem name="3">
指派给我
</MenuItem>
<MenuItem name="4">
由我参与
</MenuItem>
<MenuItem name="5">
已延期
</MenuItem>
<Submenu name="6"> <Submenu name="6">
<template slot="title"> <template slot="title"> 更多 </template>
更多
</template>
<MenuGroup title="更多"> <MenuGroup title="更多">
<MenuItem name="6-1">状态1</MenuItem> <MenuItem name="6-1">状态1</MenuItem>
<MenuItem name="6-2">状态2</MenuItem> <MenuItem name="6-2">状态2</MenuItem>
...@@ -52,8 +40,16 @@ ...@@ -52,8 +40,16 @@
</Tabs> </Tabs>
</div> </div>
</FormItem> </FormItem>
<FormItem prop="keys"><Input placeholder="请输入项目标题/计划名称/任务标题" v-model="easySearch.keys.value" v-width="240" /> </FormItem> <FormItem prop="keys"
<FormItem><Button type="primary" @click="search">查询</Button></FormItem> ><Input
placeholder="请输入项目标题/计划名称/任务标题"
v-model="easySearch.keys.value"
v-width="240"
/>
</FormItem>
<FormItem
><Button type="primary" @click="search">查询</Button></FormItem
>
<FormItem> <FormItem>
<Button @click="highSearch" type="text"> <Button @click="highSearch" type="text">
<Icon type="md-search" />高级 <Icon type="md-search" />高级
...@@ -70,22 +66,28 @@ ...@@ -70,22 +66,28 @@
<Button type="primary" class="mr10 ml10">继续</Button> <Button type="primary" class="mr10 ml10">继续</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" :fullscreen="fullScreen" footer-hide> <Modal
v-model="modal"
:title="title"
width="1200"
:fullscreen="fullScreen"
footer-hide
>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" /> <component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal> </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: "",
...@@ -99,14 +101,14 @@ export default { ...@@ -99,14 +101,14 @@ export default {
easySearch: { easySearch: {
keys: { keys: {
op: "title,projectTitle,planTitle", op: "title,projectTitle,planTitle",
value: null value: null,
} },
}, },
theme1: 'light', theme1: "light",
modal: false, modal: false,
title: "新增", title: "新增",
detail: null, detail: null,
curId: '', curId: "",
fullScreen: false, fullScreen: false,
columns: [ columns: [
// { // {
...@@ -119,7 +121,7 @@ export default { ...@@ -119,7 +121,7 @@ export default {
key: "id", key: "id",
title: this.$t("id"), title: this.$t("id"),
align: "left", align: "left",
high: true high: true,
}, },
{ {
key: "title", key: "title",
...@@ -128,22 +130,26 @@ export default { ...@@ -128,22 +130,26 @@ export default {
easy: true, easy: true,
high: true, high: true,
render: (h, params) => { render: (h, params) => {
return h('a', { return h(
"a",
{
attrs: { attrs: {
oprate: 'detail' oprate: "detail",
}, },
on: { on: {
click: () => this.viewRecord(params.row.id) click: () => this.viewRecord(params.row.id),
} },
}, params.row.title) },
} params.row.title
);
},
}, },
{ {
key: "level", key: "level",
title: this.l("level"), title: this.l("level"),
align: "center", align: "center",
high: true, high: true,
code: 'project.task.level' code: "project.task.level",
}, },
{ {
key: "projectTitle", key: "projectTitle",
...@@ -166,7 +172,7 @@ export default { ...@@ -166,7 +172,7 @@ export default {
title: this.l("status"), title: this.l("status"),
align: "center", align: "center",
high: true, high: true,
code: 'project.task.status' code: "project.task.status",
}, },
{ {
...@@ -174,7 +180,7 @@ export default { ...@@ -174,7 +180,7 @@ export default {
title: this.l("userId"), title: this.l("userId"),
align: "left", align: "left",
high: true, high: true,
type: 'user' type: "user",
}, },
{ {
key: "startDate", key: "startDate",
...@@ -193,7 +199,7 @@ export default { ...@@ -193,7 +199,7 @@ export default {
title: this.l("note"), title: this.l("note"),
align: "left", align: "left",
high: true, high: true,
hide: true hide: true,
}, },
{ {
key: "creationTime", key: "creationTime",
...@@ -208,29 +214,40 @@ export default { ...@@ -208,29 +214,40 @@ export default {
align: "left", align: "left",
high: true, high: true,
hide: true, hide: true,
type: 'user' type: "user",
}, },
{ {
title: '操作', title: "操作",
key: 'action', key: "action",
width: 200, width: 200,
align: 'center', align: "center",
render: (h, params) => { render: (h, params) => {
return h('div', { return h(
class: "action" "div",
}, [ {
h('op', { class: "action",
},
[
h("op", {
attrs: { attrs: {
icon: "ios-play", icon: "ios-play",
type: "icon", type: "icon",
title: params.row.status == 0 ? "开始" : params.row.status == 2 ? "继续" : '无法操作', title:
color: params.row.status == 0 || params.row.status == 2 ? "#19be6b" : '#ccc', params.row.status == 0
? "开始"
: params.row.status == 2
? "继续"
: "无法操作",
}, },
on: { on: {
click: () => params.row.status == 0 || params.row.status == 2 ? this.updatestatus(params.row.id, 1) : null click: () =>
} params.row.status == 0 || params.row.status == 2
? this.updatestatus(params.row.id, 1)
: null,
},
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "ios-pause", icon: "ios-pause",
type: "icon", type: "icon",
...@@ -238,127 +255,134 @@ export default { ...@@ -238,127 +255,134 @@ export default {
color: params.row.status == 1 ? "#19be6b" : "#ccc", color: params.row.status == 1 ? "#19be6b" : "#ccc",
}, },
on: { on: {
click: () => params.row.status == 1 ? this.updatestatus(params.row.id, 2) : null click: () =>
} params.row.status == 1
? this.updatestatus(params.row.id, 2)
: null,
},
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "ios-close", icon: "ios-close",
type: "icon", type: "icon",
title: params.row.status != 0 ? "完成" : "无法操作", title: "完成"
color: params.row.status != 0 ? "#19be6b" : "#ccc",
}, },
on: { on: {
click: () => params.row.status != 0 ? this.updatestatus(params.row.id, 3) : null click: () =>
} params.row.status != 0
? this.updatestatus(params.row.id, 3)
: null,
},
}), }),
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",
}, },
on: { on: {
click: () => params.row.status != 0 ? this.addRecord(params.row.id) : null click: () =>
} params.row.status != 0
? this.addRecord(params.row.id)
: null,
},
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "ios-create-outline", icon: "ios-create-outline",
type: "icon", type: "icon",
title: "修改", title: "修改",
color: "#2b85e4",
}, },
on: { on: {
click: () => this.edit(params.row.id) click: () => this.edit(params.row.id),
} },
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "ios-trash-outline", icon: "ios-trash-outline",
type: "icon", type: "icon",
title: "删除", title: "删除",
color: "#ed4014", oprate: "delete",
msg: "确认要删除吗?",
}, },
on: { on: {
click: () => this.remove(params.row.id) click: () => this.remove(params.row.id),
} },
}) }),
]) ]
} );
},
}, },
], ],
data1: [{ data1: [
{
id: 1, id: 1,
title: '测试title' title: "测试title",
}] },
} ],
};
}, },
mounted() { mounted() {
console.log(this); console.log(this);
}, },
async fetch({ async fetch({ store, params }) {
store, await store.dispatch("loadDictionary"); // 加载数据字典
params
}) {
await store.dispatch('loadDictionary') // 加载数据字典
}, },
methods: { methods: {
ok() { ok() {
this.$refs.grid.load() this.$refs.grid.load();
this.modal = false this.modal = false;
this.curId = 0; this.curId = 0;
}, },
search() { search() {
this.$refs.grid.reload(this.easySearch) this.$refs.grid.reload(this.easySearch);
}, },
add() { add() {
this.curId = 0; this.curId = 0;
this.title = "新增"; this.title = "新增";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import('./add') this.detail = () => import("./add");
this.modal = true; this.modal = true;
}, },
highSearch() { highSearch() {
this.curId = 0; this.curId = 0;
this.title = "高级搜索"; this.title = "高级搜索";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import('./search') this.detail = () => import("./search");
this.modal = true; this.modal = true;
}, },
copy(id) { copy(id) {
this.curId = id; this.curId = id;
this.title = "克隆"; this.title = "克隆";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import('./add') this.detail = () => import("./add");
this.modal = true; this.modal = true;
}, },
view(id) { view(id) {
this.curId = id; this.curId = id;
this.title = "详情"; this.title = "详情";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import('./detail') this.detail = () => import("./detail");
this.modal = true; this.modal = true;
}, },
edit(id) { edit(id) {
this.curId = id; this.curId = id;
this.title = "编辑"; this.title = "编辑";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import('./edit') this.detail = () => import("./edit");
this.modal = true; this.modal = true;
}, },
remove(id) { remove(id) {
Api.delete(id).then((r) => { Api.delete(id).then((r) => {
if (r.success) { if (r.success) {
this.$refs.grid.load(); this.$refs.grid.load();
this.$Message.success('删除成功') this.$Message.success("删除成功");
} }
}) });
}, },
cancel() { cancel() {
this.curId = 0; this.curId = 0;
this.modal = false this.modal = false;
}, },
onHide() { onHide() {
// this.$Message.info("收起左侧树") // this.$Message.info("收起左侧树")
...@@ -372,8 +396,8 @@ export default { ...@@ -372,8 +396,8 @@ export default {
let where = { let where = {
bomId: { bomId: {
op: "In", op: "In",
value: ids value: ids,
} },
}; };
this.$refs.grid.reload(where); this.$refs.grid.reload(where);
}, },
...@@ -381,44 +405,46 @@ export default { ...@@ -381,44 +405,46 @@ export default {
let params = { let params = {
id: valId, id: valId,
status: valStatus, status: valStatus,
detail: '' detail: "",
} };
Api.updatestatus(params).then(r => { Api.updatestatus(params)
.then((r) => {
if (r.success) { if (r.success) {
this.$refs.grid.load(); this.$refs.grid.load();
this.$Message.success('操作成功') this.$Message.success("操作成功");
} else { } else {
this.$Message.error('操作失败') this.$Message.error("操作失败");
} }
}).catch(err => {
this.disabled = false;
this.$Message.error('操作失败')
console.warn(err)
}) })
.catch((err) => {
this.disabled = false;
this.$Message.error("操作失败");
console.warn(err);
});
}, },
onSelect(val) { onSelect(val) {
this.$refs.grid.reload(this.easySearch) this.$refs.grid.reload(this.easySearch);
}, },
viewRecord(id) { viewRecord(id) {
this.curId = id; this.curId = id;
this.title = "查看记录"; this.title = "查看记录";
this.fullScreen = true; this.fullScreen = true;
this.detail = () => import('./detail') this.detail = () => import("./detail");
this.modal = true; this.modal = true;
}, },
addRecord(id) { addRecord(id) {
this.curId = id; this.curId = id;
this.title = "新增记录"; this.title = "新增记录";
this.fullScreen = true; this.fullScreen = true;
this.detail = () => import('../record/add') this.detail = () => import("../record/add");
this.modal = true; this.modal = true;
}, },
l(key) { l(key) {
let vkey = "project_task" + "." + key; let vkey = "project_task" + "." + key;
return this.$t(vkey) || key return this.$t(vkey) || key;
} },
} },
} };
</script> </script>
<style lang="less"> <style lang="less">
......
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