Commit 77a5571f authored by 周远喜's avatar 周远喜

数据字典和权限过滤

parent 7edeaf19
...@@ -85,7 +85,13 @@ export default { ...@@ -85,7 +85,13 @@ export default {
}, },
listSlecet() { listSlecet() {
let data = { let data = {
conditions: [], conditions: [
{
fieldName: "userId",
fieldValue: this.$store.state.userInfo.id,
conditionalType: "Equal",
},
],
sortBy: "id", sortBy: "id",
isDesc: false, isDesc: false,
}; };
...@@ -93,15 +99,14 @@ export default { ...@@ -93,15 +99,14 @@ export default {
if (r.result) { if (r.result) {
this.projectList = r.result; this.projectList = r.result;
if (this.curId) { if (this.curId) {
this.projectList.map(u=>{ this.projectList.map((u) => {
if(u.id==this.curId){ if (u.id == this.curId) {
this.downName = u.title; this.downName = u.title;
} }
}) });
} else { } else {
this.downName = this.projectList[0].title; this.downName = this.projectList[0].title;
this.curdId = this.projectList[0].id; this.curdId = this.projectList[0].id;
} }
this.loadTree(this.curId); this.loadTree(this.curId);
} }
...@@ -115,6 +120,11 @@ export default { ...@@ -115,6 +120,11 @@ export default {
fieldValue: this.curdId, fieldValue: this.curdId,
conditionalType: "Equal", conditionalType: "Equal",
}, },
{
fieldName: "userId",
fieldValue: this.$store.state.userInfo.id,
conditionalType: "Equal",
},
], ],
}; };
this.$api.post(`${material}/projectplan/list`, params).then((r) => { this.$api.post(`${material}/projectplan/list`, params).then((r) => {
......
<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">
<ProjectTaskTree :curId="projectId" @on-hide="onHide" @on-select="productSearch" /> <ProjectTaskTree
:curId="projectId"
@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" :conditions="easySearch" :lazy="true"> <DataGrid
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:lazy="true"
>
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" inline> <Form ref="formInline" inline>
<FormItem> <FormItem>
<div class="taskMenu"> <div class="taskMenu">
<Menu mode="horizontal" active-name="1" @on-select="onSelect"> <Menu mode="horizontal" active-name="-1" @on-select="onSelect">
<MenuItem name="1"> <MenuItem name="-1"> 所有 </MenuItem>
所有 <MenuItem name="0"> 待确认 </MenuItem>
</MenuItem> <MenuItem name="1"> 工作中 </MenuItem>
<MenuItem name="2"> <MenuItem name="2"> 已完成 </MenuItem>
待确认 <MenuItem name="3"> 已冻结 </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">
...@@ -45,8 +45,16 @@ ...@@ -45,8 +45,16 @@
</Menu> </Menu>
</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">
...@@ -57,21 +65,35 @@ ...@@ -57,21 +65,35 @@
</Form> </Form>
</template> </template>
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add" v-if="planId!=''">新增</Button> <Button type="primary" @click="add" v-if="planId != ''">新增</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1200" :fullscreen="fullScreen" footer-hide> <Modal
<component :is="detail" :eid="curId" :pid="planId" :projectId="projectId" :row="rowObj" @on-close="cancel" @on-ok="ok" /> v-model="modal"
:title="title"
width="1200"
:fullscreen="fullScreen"
footer-hide
>
<component
:is="detail"
:eid="curId"
:pid="planId"
:projectId="projectId"
:row="rowObj"
@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";
export default { export default {
name: 'list', name: "list",
components: { components: {
Search, Search,
}, },
...@@ -87,27 +109,31 @@ export default { ...@@ -87,27 +109,31 @@ export default {
easySearch: { easySearch: {
keys: { keys: {
op: "title", op: "title",
value: null value: null,
}, },
projectId: { projectId: {
op: "Equal", op: "Equal",
value: '' value: "",
}, },
planId: { planId: {
op: "In", op: "In",
value: [] value: [],
}, },
status: { status: {
op: "In", op: "In",
value: [] value: [],
} },
userId: {
op: "Equal",
value: this.$store.state.userInfo.id,
},
}, },
theme1: 'light', theme1: "light",
modal: false, modal: false,
title: "新增", title: "新增",
detail: null, detail: null,
rowObj: null, rowObj: null,
curId: '', curId: "",
fullScreen: false, fullScreen: false,
projectId: this.eid, projectId: this.eid,
columns: [ columns: [
...@@ -131,15 +157,20 @@ export default { ...@@ -131,15 +157,20 @@ 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, params.row.status) click: () =>
} this.viewRecord(params.row.id, params.row.status),
}, params.row.title) },
} },
params.row.title
);
},
}, },
{ {
key: "level", key: "level",
...@@ -147,7 +178,7 @@ export default { ...@@ -147,7 +178,7 @@ export default {
align: "center", align: "center",
high: true, high: true,
width: 80, width: 80,
code: 'project.task.level' code: "project.task.level",
}, },
{ {
key: "status", key: "status",
...@@ -155,7 +186,7 @@ export default { ...@@ -155,7 +186,7 @@ export default {
align: "center", align: "center",
high: true, high: true,
width: 100, width: 100,
code: 'project.task.status' code: "project.task.status",
}, },
{ {
...@@ -163,39 +194,39 @@ export default { ...@@ -163,39 +194,39 @@ 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",
title: '计划日期', title: "计划日期",
align: "center", align: "center",
high: true, high: true,
width: 280, width: 280,
render: (h, params) => { render: (h, params) => {
return h('DateRange', { return h("DateRange", {
props: { props: {
value: params.row, value: params.row,
start: 'plansToStartDate', start: "plansToStartDate",
end: 'plansToEndTime', end: "plansToEndTime",
} },
}) });
} },
}, },
{ {
key: "startDate", key: "startDate",
title: '执行日期', title: "执行日期",
align: "center", align: "center",
high: true, high: true,
width: 280, width: 280,
render: (h, params) => { render: (h, params) => {
return h('DateRange', { return h("DateRange", {
props: { props: {
value: params.row, value: params.row,
start: "runStartDate", start: "runStartDate",
end: "runEndDate", end: "runEndDate",
} },
}) });
} },
}, },
{ {
key: "workHour", key: "workHour",
...@@ -204,29 +235,33 @@ export default { ...@@ -204,29 +235,33 @@ export default {
high: true, high: true,
width: 80, width: 80,
render: (h, params) => { render: (h, params) => {
return h('a', { return h(
"a",
{
attrs: { attrs: {
oprate: 'detail' oprate: "detail",
}, },
on: { on: {
click: () => this.viewWork(params.row.id) click: () => this.viewWork(params.row.id),
} },
}, params.row.workHour) },
} params.row.workHour
);
},
}, },
{ {
key: "note", key: "note",
title: this.l("note"), title: this.l("note"),
align: "left", align: "left",
high: true, high: true,
hide: true hide: true,
}, },
{ {
key: "creatorUserId", key: "creatorUserId",
title: this.l("creatorUserId"), title: this.l("creatorUserId"),
align: "left", align: "left",
high: true, high: true,
type: 'user' type: "user",
}, },
{ {
key: "creationTime", key: "creationTime",
...@@ -236,166 +271,172 @@ export default { ...@@ -236,166 +271,172 @@ export default {
width: 150, width: 150,
}, },
{ {
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: "md-arrow-dropright-circle", icon: "md-arrow-dropright-circle",
type: "icon", type: "icon",
oprate: "edit", oprate: "edit",
title: "开始", title: "开始",
disable: params.row.status == 0 ? false : true disable: params.row.status == 0 ? false : true,
}, },
on: { on: {
click: () => this.updatepart(params.row.id, 1) click: () => this.updatepart(params.row.id, 1),
} },
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "ios-alarm", icon: "ios-alarm",
type: "icon", type: "icon",
oprate: "edit", oprate: "edit",
title: "汇报工作", title: "汇报工作",
disable: params.row.status == 1 || params.row.status == 3 ? false : true disable:
params.row.status == 1 || params.row.status == 3
? false
: true,
}, },
on: { on: {
click: () => this.viewRecord(params.row.id, params.row.status) click: () =>
} this.viewRecord(params.row.id, params.row.status),
},
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "md-add", icon: "md-add",
type: "icon", type: "icon",
oprate: "add", oprate: "add",
title: "新增记录", title: "新增记录",
disable: params.row.status == 1 ? false : true disable: params.row.status == 1 ? false : true,
}, },
on: { on: {
click: () => this.addRecord(params.row) click: () => this.addRecord(params.row),
} },
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "md-create", icon: "md-create",
type: "icon", type: "icon",
oprate: "edit", oprate: "edit",
title: "修改", title: "修改",
disable: params.row.status == 0 ? false : true disable: params.row.status == 0 ? false : true,
}, },
on: { on: {
click: () => this.edit(params.row.id) click: () => this.edit(params.row.id),
} },
}), }),
h('op', { h("op", {
attrs: { attrs: {
icon: "md-trash", icon: "md-trash",
type: "icon", type: "icon",
title: "删除", title: "删除",
oprate: 'delete', oprate: "delete",
disable: params.row.status == 0 ? false : true disable: params.row.status == 0 ? false : true,
}, },
on: { on: {
click: () => this.remove(params.row.id) click: () => this.remove(params.row.id),
} },
}) }),
]) ]
} );
},
}, },
], ],
data1: [{ data1: [
{
id: 1, id: 1,
title: '测试title' title: "测试title",
}], },
],
data: [], data: [],
planId: '', //当前计划Id planId: "", //当前计划Id
planIdsCur: [] planIdsCur: [],
} };
}, },
props: { props: {
eid: String eid: String,
}, },
async fetch({ async fetch({ store, params }) {
store, await store.dispatch("loadDictionary"); // 加载数据字典
params
}) {
await store.dispatch('loadDictionary') // 加载数据字典
}, },
created() { created() {
if (this.eid != '') { if (this.eid != "") {
this.projectId = this.eid this.projectId = this.eid;
this.easySearch.projectId.value = this.eid this.easySearch.projectId.value = this.eid;
} }
this.treeHeight = window.innerHeight - 150; this.treeHeight = window.innerHeight - 150;
}, },
mounted() { mounted() {
if (this.eid != "") { if (this.eid != "") {
this.easySearch.projectId.value = this.eid this.easySearch.projectId.value = this.eid;
this.$refs.grid.reload(this.easySearch); this.$refs.grid.reload(this.easySearch);
} }
}, },
methods: { methods: {
ok() { ok() {
this.$refs.grid.load() this.$refs.grid.load();
this.modal = false this.modal = false;
this.curId = ''; this.curId = "";
}, },
search() { search() {
this.easySearch.planId.value = this.planIdsCur this.easySearch.planId.value = this.planIdsCur;
this.$refs.grid.reload(this.easySearch) this.$refs.grid.reload(this.easySearch);
}, },
add() { add() {
this.curId = this.projectId; this.curId = this.projectId;
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 = ''; this.curId = "";
this.modal = false this.modal = false;
}, },
onHide() { onHide() {
// this.$Message.info("收起左侧树") // this.$Message.info("收起左侧树")
...@@ -406,85 +447,112 @@ export default { ...@@ -406,85 +447,112 @@ export default {
this.showMenu = true; this.showMenu = true;
}, },
productSearch(id, item, planIds) { productSearch(id, item, planIds) {
this.planId = item.selected ? id : ''; this.planId = item.selected ? id : "";
this.projectId=item.projectId; this.projectId = item.projectId;
this.planIdsCur = item.selected ? planIds : [] this.planIdsCur = item.selected ? planIds : [];
let where = { let where = {
planId: { planId: {
op: "In", op: "In",
value: item.selected ? planIds : [] value: item.selected ? planIds : [],
}, },
projectId: { projectId: {
op: "Equal", op: "Equal",
value: item.projectId value: item.projectId,
}, },
}; };
this.curId= this.curId = this.$refs.grid.reload(where);
this.$refs.grid.reload(where);
}, },
updatepart(valId, valStatus) { updatepart(valId, valStatus) {
let params = { let params = {
id: valId, id: valId,
status: valStatus status: valStatus,
} };
if (valStatus == 1) { if (valStatus == 1) {
params.startDate = '' params.startDate = "";
} }
if (valStatus == 2) { if (valStatus == 2) {
params.endDate = '' params.endDate = "";
} }
Api.updatepart(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("操作成功");
} 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) if (val == -1) {
this.easySearch = {
keys: {
op: "title",
value: null,
},
projectId: {
op: "Equal",
value: "",
},
planId: {
op: "In",
value: [],
},
status: {
op: "In",
value: [],
},
userId: {
op: "Equal",
value: this.$store.state.userInfo.id,
},
};
} else {
this.easySearch.status.value = [val];
}
this.$refs.grid.reload(this.easySearch);
}, },
viewRecord(id, status) { viewRecord(id, status) {
this.curId = id; this.curId = id;
this.tastkStatus = status; this.tastkStatus = status;
this.title = "查看记录"; this.title = "查看记录";
this.fullScreen = true; this.fullScreen = true;
this.detail = () => import('./detail') this.detail = () => import("./detail");
this.modal = true; this.modal = true;
}, },
viewWork(id) { viewWork(id) {
this.curId = id; this.curId = id;
this.title = "查看工时"; this.title = "查看工时";
this.fullScreen = false; this.fullScreen = false;
this.detail = () => import('../record') this.detail = () => import("../record");
this.modal = true; this.modal = true;
}, },
addRecord(row) { addRecord(row) {
this.curId = row.id; this.curId = row.id;
this.rowObj = row this.rowObj = row;
this.title = "新增记录"; this.title = "新增记录";
this.fullScreen = false; this.fullScreen = false;
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;
} },
}, },
watch: { watch: {
eid(v) { eid(v) {
if (v != "") { if (v != "") {
this.eid = v this.eid = v;
} }
} },
} },
} };
</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