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

数据字典和权限过滤

parent 7edeaf19
......@@ -85,7 +85,13 @@ export default {
},
listSlecet() {
let data = {
conditions: [],
conditions: [
{
fieldName: "userId",
fieldValue: this.$store.state.userInfo.id,
conditionalType: "Equal",
},
],
sortBy: "id",
isDesc: false,
};
......@@ -93,15 +99,14 @@ export default {
if (r.result) {
this.projectList = r.result;
if (this.curId) {
this.projectList.map(u=>{
if(u.id==this.curId){
this.projectList.map((u) => {
if (u.id == this.curId) {
this.downName = u.title;
}
})
});
} else {
this.downName = this.projectList[0].title;
this.curdId = this.projectList[0].id;
}
this.loadTree(this.curId);
}
......@@ -115,6 +120,11 @@ export default {
fieldValue: this.curdId,
conditionalType: "Equal",
},
{
fieldName: "userId",
fieldValue: this.$store.state.userInfo.id,
conditionalType: "Equal",
},
],
};
this.$api.post(`${material}/projectplan/list`, params).then((r) => {
......
<template>
<Layout class="full">
<Layout class="full">
<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>
<div v-if="!showMenu" class="show_menu">
<a class="menu_play fr" @click="showMenuFn" title="展开">
<Icon type="ios-arrow-forward" size="24" />
</a>
<a class="menu_play fr" @click="showMenuFn" title="展开">
<Icon type="ios-arrow-forward" size="24" />
</a>
</div>
<Content class="content" :class="!showMenu?'con_bord':''">
<DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch" :lazy="true">
<template slot="easySearch">
<Form ref="formInline" inline>
<FormItem>
<div class="taskMenu">
<Menu mode="horizontal" active-name="1" @on-select="onSelect">
<MenuItem name="1">
所有
</MenuItem>
<MenuItem name="2">
待确认
</MenuItem>
<MenuItem name="3">
工作中
</MenuItem>
<MenuItem name="4">
已完成
</MenuItem>
<MenuItem name="5">
已冻结
</MenuItem>
<!--
<Content class="content" :class="!showMenu ? 'con_bord' : ''">
<DataGrid
:columns="columns"
ref="grid"
:action="action"
:conditions="easySearch"
:lazy="true"
>
<template slot="easySearch">
<Form ref="formInline" inline>
<FormItem>
<div class="taskMenu">
<Menu mode="horizontal" active-name="-1" @on-select="onSelect">
<MenuItem name="-1"> 所有 </MenuItem>
<MenuItem name="0"> 待确认 </MenuItem>
<MenuItem name="1"> 工作中 </MenuItem>
<MenuItem name="2"> 已完成 </MenuItem>
<MenuItem name="3"> 已冻结 </MenuItem>
<!--
<Submenu name="6">
<template slot="title">
更多
......@@ -42,500 +42,568 @@
</MenuGroup>
</Submenu>
-->
</Menu>
</div>
</FormItem>
<FormItem prop="keys"><Input placeholder="请输入项目标题/计划名称/任务标题" v-model="easySearch.keys.value" v-width="240" /> </FormItem>
<FormItem><Button type="primary" @click="search">查询</Button></FormItem>
<!--
</Menu>
</div>
</FormItem>
<FormItem prop="keys"
><Input
placeholder="请输入项目标题/计划名称/任务标题"
v-model="easySearch.keys.value"
v-width="240"
/>
</FormItem>
<FormItem
><Button type="primary" @click="search">查询</Button></FormItem
>
<!--
<FormItem>
<Button @click="highSearch" type="text">
<Icon type="md-search" />高级
</Button>
</FormItem>
-->
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add" v-if="planId!=''">新增</Button>
</template>
</DataGrid>
<Modal 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>
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add" v-if="planId != ''">新增</Button>
</template>
</DataGrid>
<Modal
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>
</Content>
</Layout>
</Layout>
</template>
<script>
import Api from './api'
import Search from './search'
import Api from "./api";
import Search from "./search";
export default {
name: 'list',
components: {
Search,
},
head: {
title: "",
author: "henq",
description: "project_task 10/20/2020 9:27:58 AM",
},
data() {
return {
action: Api.index,
showMenu: true,
easySearch: {
keys: {
op: "title",
value: null
},
projectId: {
op: "Equal",
value: ''
},
planId: {
op: "In",
value: []
},
status: {
op: "In",
value: []
}
},
theme1: 'light',
modal: false,
title: "新增",
detail: null,
rowObj: null,
curId: '',
fullScreen: false,
projectId: this.eid,
columns: [
// {
// key: "selection",
// type: "selection",
// width: 50,
// align: "center"
// },
{
key: "id",
title: this.$t("id"),
align: "left",
high: true,
hide: 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.status)
}
}, params.row.title)
}
},
{
key: "level",
title: this.l("level"),
align: "center",
high: true,
width: 80,
code: 'project.task.level'
},
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
width: 100,
code: 'project.task.status'
},
{
key: "userId",
title: this.l("userId"),
align: "left",
high: true,
type: 'user'
},
{
key: "startDate",
title: '计划日期',
align: "center",
high: true,
width: 280,
render: (h, params) => {
return h('DateRange', {
props: {
value: params.row,
start: 'plansToStartDate',
end: 'plansToEndTime',
}
})
}
},
{
key: "startDate",
title: '执行日期',
align: "center",
high: true,
width: 280,
render: (h, params) => {
return h('DateRange', {
props: {
value: params.row,
start: "runStartDate",
end: "runEndDate",
}
})
}
},
{
key: "workHour",
title: this.l("workHour"),
align: "right",
high: true,
width: 80,
render: (h, params) => {
return h('a', {
attrs: {
oprate: 'detail'
},
on: {
click: () => this.viewWork(params.row.id)
}
}, params.row.workHour)
}
},
{
key: "note",
title: this.l("note"),
align: "left",
high: true,
hide: true
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
type: 'user'
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "center",
high: true,
width: 150,
},
{
title: '操作',
key: 'action',
width: 200,
align: 'center',
render: (h, params) => {
return h('div', {
class: "action"
}, [
h('op', {
attrs: {
icon: "md-arrow-dropright-circle",
type: "icon",
oprate: "edit",
title: "开始",
disable: params.row.status == 0 ? false : true
},
on: {
click: () => this.updatepart(params.row.id, 1)
}
}),
h('op', {
attrs: {
icon: "ios-alarm",
type: "icon",
oprate: "edit",
title: "汇报工作",
disable: params.row.status == 1 || params.row.status == 3 ? false : true
},
on: {
click: () => this.viewRecord(params.row.id, params.row.status)
}
}),
h('op', {
attrs: {
icon: "md-add",
type: "icon",
oprate: "add",
title: "新增记录",
disable: params.row.status == 1 ? false : true
},
on: {
click: () => this.addRecord(params.row)
}
}),
h('op', {
attrs: {
icon: "md-create",
type: "icon",
oprate: "edit",
title: "修改",
disable: params.row.status == 0 ? false : true
},
on: {
click: () => this.edit(params.row.id)
}
}),
h('op', {
attrs: {
icon: "md-trash",
type: "icon",
title: "删除",
oprate: 'delete',
disable: params.row.status == 0 ? false : true
},
on: {
click: () => this.remove(params.row.id)
}
})
])
}
},
],
data1: [{
id: 1,
title: '测试title'
}],
data: [],
planId: '', //当前计划Id
planIdsCur: []
}
},
props: {
eid: String
},
async fetch({
store,
params
}) {
await store.dispatch('loadDictionary') // 加载数据字典
},
created() {
if (this.eid != '') {
this.projectId = this.eid
this.easySearch.projectId.value = this.eid
}
this.treeHeight = window.innerHeight - 150;
},
mounted() {
if (this.eid != "") {
this.easySearch.projectId.value = this.eid
this.$refs.grid.reload(this.easySearch);
}
},
methods: {
ok() {
this.$refs.grid.load()
this.modal = false
this.curId = '';
name: "list",
components: {
Search,
},
head: {
title: "",
author: "henq",
description: "project_task 10/20/2020 9:27:58 AM",
},
data() {
return {
action: Api.index,
showMenu: true,
easySearch: {
keys: {
op: "title",
value: null,
},
search() {
this.easySearch.planId.value = this.planIdsCur
this.$refs.grid.reload(this.easySearch)
projectId: {
op: "Equal",
value: "",
},
add() {
this.curId = this.projectId;
this.title = "新增";
this.fullScreen = false;
this.detail = () => import('./add')
this.modal = true;
planId: {
op: "In",
value: [],
},
highSearch() {
this.curId = 0;
this.title = "高级搜索";
this.fullScreen = false;
this.detail = () => import('./search')
this.modal = true;
status: {
op: "In",
value: [],
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.fullScreen = false;
this.detail = () => import('./add')
this.modal = true;
userId: {
op: "Equal",
value: this.$store.state.userInfo.id,
},
view(id) {
this.curId = id;
this.title = "详情";
this.fullScreen = false;
this.detail = () => import('./detail')
this.modal = true;
},
theme1: "light",
modal: false,
title: "新增",
detail: null,
rowObj: null,
curId: "",
fullScreen: false,
projectId: this.eid,
columns: [
// {
// key: "selection",
// type: "selection",
// width: 50,
// align: "center"
// },
{
key: "id",
title: this.$t("id"),
align: "left",
high: true,
hide: true,
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.fullScreen = false;
this.detail = () => import('./edit')
this.modal = 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.status),
},
},
params.row.title
);
},
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success('删除成功')
}
})
{
key: "level",
title: this.l("level"),
align: "center",
high: true,
width: 80,
code: "project.task.level",
},
cancel() {
this.curId = '';
this.modal = false
{
key: "status",
title: this.l("status"),
align: "center",
high: true,
width: 100,
code: "project.task.status",
},
{
key: "userId",
title: this.l("userId"),
align: "left",
high: true,
type: "user",
},
onHide() {
// this.$Message.info("收起左侧树")
this.showMenu = false;
{
key: "startDate",
title: "计划日期",
align: "center",
high: true,
width: 280,
render: (h, params) => {
return h("DateRange", {
props: {
value: params.row,
start: "plansToStartDate",
end: "plansToEndTime",
},
});
},
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
{
key: "startDate",
title: "执行日期",
align: "center",
high: true,
width: 280,
render: (h, params) => {
return h("DateRange", {
props: {
value: params.row,
start: "runStartDate",
end: "runEndDate",
},
});
},
},
productSearch(id, item, planIds) {
this.planId = item.selected ? id : '';
this.projectId=item.projectId;
this.planIdsCur = item.selected ? planIds : []
let where = {
planId: {
op: "In",
value: item.selected ? planIds : []
{
key: "workHour",
title: this.l("workHour"),
align: "right",
high: true,
width: 80,
render: (h, params) => {
return h(
"a",
{
attrs: {
oprate: "detail",
},
projectId: {
op: "Equal",
value: item.projectId
on: {
click: () => this.viewWork(params.row.id),
},
};
this.curId=
this.$refs.grid.reload(where);
},
params.row.workHour
);
},
},
updatepart(valId, valStatus) {
let params = {
id: valId,
status: valStatus
}
if (valStatus == 1) {
params.startDate = ''
}
if (valStatus == 2) {
params.endDate = ''
}
Api.updatepart(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)
})
{
key: "note",
title: this.l("note"),
align: "left",
high: true,
hide: true,
},
onSelect(val) {
this.$refs.grid.reload(this.easySearch)
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
type: "user",
},
viewRecord(id, status) {
this.curId = id;
this.tastkStatus = status;
this.title = "查看记录";
this.fullScreen = true;
this.detail = () => import('./detail')
this.modal = true;
{
key: "creationTime",
title: this.l("creationTime"),
align: "center",
high: true,
width: 150,
},
viewWork(id) {
this.curId = id;
this.title = "查看工时";
this.fullScreen = false;
this.detail = () => import('../record')
this.modal = true;
{
title: "操作",
key: "action",
width: 200,
align: "center",
render: (h, params) => {
return h(
"div",
{
class: "action",
},
[
h("op", {
attrs: {
icon: "md-arrow-dropright-circle",
type: "icon",
oprate: "edit",
title: "开始",
disable: params.row.status == 0 ? false : true,
},
on: {
click: () => this.updatepart(params.row.id, 1),
},
}),
h("op", {
attrs: {
icon: "ios-alarm",
type: "icon",
oprate: "edit",
title: "汇报工作",
disable:
params.row.status == 1 || params.row.status == 3
? false
: true,
},
on: {
click: () =>
this.viewRecord(params.row.id, params.row.status),
},
}),
h("op", {
attrs: {
icon: "md-add",
type: "icon",
oprate: "add",
title: "新增记录",
disable: params.row.status == 1 ? false : true,
},
on: {
click: () => this.addRecord(params.row),
},
}),
h("op", {
attrs: {
icon: "md-create",
type: "icon",
oprate: "edit",
title: "修改",
disable: params.row.status == 0 ? false : true,
},
on: {
click: () => this.edit(params.row.id),
},
}),
h("op", {
attrs: {
icon: "md-trash",
type: "icon",
title: "删除",
oprate: "delete",
disable: params.row.status == 0 ? false : true,
},
on: {
click: () => this.remove(params.row.id),
},
}),
]
);
},
},
addRecord(row) {
this.curId = row.id;
this.rowObj = row
this.title = "新增记录";
this.fullScreen = false;
this.detail = () => import('../record/add')
this.modal = true;
],
data1: [
{
id: 1,
title: "测试title",
},
l(key) {
let vkey = "project_task" + "." + key;
return this.$t(vkey) || key
}
],
data: [],
planId: "", //当前计划Id
planIdsCur: [],
};
},
props: {
eid: String,
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
created() {
if (this.eid != "") {
this.projectId = this.eid;
this.easySearch.projectId.value = this.eid;
}
this.treeHeight = window.innerHeight - 150;
},
mounted() {
if (this.eid != "") {
this.easySearch.projectId.value = this.eid;
this.$refs.grid.reload(this.easySearch);
}
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = "";
},
search() {
this.easySearch.planId.value = this.planIdsCur;
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = this.projectId;
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;
},
watch: {
eid(v) {
if (v != "") {
this.eid = v
}
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
}
}
});
},
cancel() {
this.curId = "";
this.modal = false;
},
onHide() {
// this.$Message.info("收起左侧树")
this.showMenu = false;
},
showMenuFn() {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
productSearch(id, item, planIds) {
this.planId = item.selected ? id : "";
this.projectId = item.projectId;
this.planIdsCur = item.selected ? planIds : [];
let where = {
planId: {
op: "In",
value: item.selected ? planIds : [],
},
projectId: {
op: "Equal",
value: item.projectId,
},
};
this.curId = this.$refs.grid.reload(where);
},
updatepart(valId, valStatus) {
let params = {
id: valId,
status: valStatus,
};
if (valStatus == 1) {
params.startDate = "";
}
if (valStatus == 2) {
params.endDate = "";
}
Api.updatepart(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) {
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) {
this.curId = id;
this.tastkStatus = status;
this.title = "查看记录";
this.fullScreen = true;
this.detail = () => import("./detail");
this.modal = true;
},
viewWork(id) {
this.curId = id;
this.title = "查看工时";
this.fullScreen = false;
this.detail = () => import("../record");
this.modal = true;
},
addRecord(row) {
this.curId = row.id;
this.rowObj = row;
this.title = "新增记录";
this.fullScreen = false;
this.detail = () => import("../record/add");
this.modal = true;
},
l(key) {
let vkey = "project_task" + "." + key;
return this.$t(vkey) || key;
},
},
watch: {
eid(v) {
if (v != "") {
this.eid = v;
}
},
},
};
</script>
<style lang="less">
.full {
margin-top: 0;
margin-top: 0;
.content {
margin-top: 10px;
.content {
margin-top: 10px;
.ivu-icon-ios-add:before {
content: "\f341";
}
.ivu-icon-ios-add:before {
content: "\f341";
}
.ivu-icon-ios-remove:before {
content: "\f33d";
}
.ivu-icon-ios-remove:before {
content: "\f33d";
}
}
}
.taskTab .ivu-tabs-bar {
border-bottom: 1px solid #fff;
margin-bottom: 2px;
border-bottom: 1px solid #fff;
margin-bottom: 2px;
}
.taskMenu {
font-size: 12px;
font-size: 12px;
.ivu-menu-horizontal {
height: 30px;
line-height: 30px;
}
.ivu-menu-horizontal {
height: 30px;
line-height: 30px;
}
.ivu-menu-light {
&:after {
height: 0px !important;
}
.ivu-menu-light {
&:after {
height: 0px !important;
}
}
}
.actionCur {
a {
span {
padding: 4px;
}
a {
span {
padding: 4px;
}
i {
padding: 4px;
border-radius: 3px;
font-weight: bold;
font-size: 18px;
}
i {
padding: 4px;
border-radius: 3px;
font-weight: bold;
font-size: 18px;
}
}
}
</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