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

ok

parent 3488f24a
......@@ -21,7 +21,7 @@ export default {
},
value: {
type: String,
default: '2001-01-01 00:00:00'
default: ''
},
},
created() {
......
<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">
<slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span>
<Icon v-if="type == 'icon'" :type="icon" :color="color" />
<span v-else="type == 'text'" v-text="text"></span>
</slot>
</a>
</Tooltip>
<a class="op" v-else :class="css" @click="handler">
</Tooltip>
<a class="op" v-else :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" :color="color" />
<span v-else="type=='text'" v-text="text"></span>
<Icon v-if="type == 'icon'" :type="icon" :color="color" />
<span v-else="type == 'text'" v-text="text"></span>
</slot>
</a>
</a>
</template>
<script>
......@@ -20,30 +20,35 @@ export default {
name: "op",
props: {
icon: {
type: String
type: String,
},
oprate: {
type: String
type: String,
},
type: {
type: String,
default: "text"
default: "text",
},
title: {
type: String,
},
msg: {
type: String,
default: "确认要删除吗?"
default: "确认要删除吗?",
},
color: {
type: String
}
type: String,
},
disalbed: {
// 0 启用 1 禁用 2权限不足
type: Number,
default: 0,
},
},
data() {
return {
text: "",
css: "detail"
css: "detail",
};
},
created() {
......@@ -52,7 +57,7 @@ export default {
edit: "编辑",
add: "添加",
delete: "删除",
remove: "删除"
remove: "删除",
};
if (oprates[this.oprate]) {
......@@ -66,19 +71,25 @@ export default {
},
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("没有权限")
}
}
},
},
};
</script>
......
<template>
<Layout class="full">
<Layout class="full">
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<ProductTree @on-hide="onHide" @on-select="productSearch" />
</Sider>
......@@ -8,32 +8,20 @@
<Icon type="ios-arrow-forward" size="24" />
</a>
</div>
<Content class="content" :class="!showMenu?'con_bord':''">
<Content class="content" :class="!showMenu ? 'con_bord' : ''">
<DataGrid :columns="columns" ref="grid" :action="action">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem>
<div class="taskMenu">
<Menu mode="horizontal" active-name="2" @on-select="onSelect">
<MenuItem name="1">
所有
</MenuItem>
<MenuItem name="2">
未关闭
</MenuItem>
<MenuItem name="3">
指派给我
</MenuItem>
<MenuItem name="4">
由我参与
</MenuItem>
<MenuItem name="5">
已延期
</MenuItem>
<MenuItem name="1"> 所有 </MenuItem>
<MenuItem name="2"> 未关闭 </MenuItem>
<MenuItem name="3"> 指派给我 </MenuItem>
<MenuItem name="4"> 由我参与 </MenuItem>
<MenuItem name="5"> 已延期 </MenuItem>
<Submenu name="6">
<template slot="title">
更多
</template>
<template slot="title"> 更多 </template>
<MenuGroup title="更多">
<MenuItem name="6-1">状态1</MenuItem>
<MenuItem name="6-2">状态2</MenuItem>
......@@ -52,8 +40,16 @@
</Tabs>
</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 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" />高级
......@@ -70,22 +66,28 @@
<Button type="primary" class="mr10 ml10">继续</Button>
</template>
</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" />
</Modal>
</Content>
</Layout>
</Layout>
</template>
<script>
import Api from './api'
import Search from './search'
import Api from "./api";
import Search from "./search";
import ProductTree from "@/components/page/productTree.vue";
export default {
name: 'list',
name: "list",
components: {
Search,
ProductTree
ProductTree,
},
head: {
title: "",
......@@ -99,14 +101,14 @@ export default {
easySearch: {
keys: {
op: "title,projectTitle,planTitle",
value: null
}
value: null,
},
},
theme1: 'light',
theme1: "light",
modal: false,
title: "新增",
detail: null,
curId: '',
curId: "",
fullScreen: false,
columns: [
// {
......@@ -119,7 +121,7 @@ export default {
key: "id",
title: this.$t("id"),
align: "left",
high: true
high: true,
},
{
key: "title",
......@@ -128,22 +130,26 @@ export default {
easy: true,
high: true,
render: (h, params) => {
return h('a', {
return h(
"a",
{
attrs: {
oprate: 'detail'
oprate: "detail",
},
on: {
click: () => this.viewRecord(params.row.id)
}
}, params.row.title)
}
click: () => this.viewRecord(params.row.id),
},
},
params.row.title
);
},
},
{
key: "level",
title: this.l("level"),
align: "center",
high: true,
code: 'project.task.level'
code: "project.task.level",
},
{
key: "projectTitle",
......@@ -166,7 +172,7 @@ export default {
title: this.l("status"),
align: "center",
high: true,
code: 'project.task.status'
code: "project.task.status",
},
{
......@@ -174,7 +180,7 @@ export default {
title: this.l("userId"),
align: "left",
high: true,
type: 'user'
type: "user",
},
{
key: "startDate",
......@@ -193,7 +199,7 @@ export default {
title: this.l("note"),
align: "left",
high: true,
hide: true
hide: true,
},
{
key: "creationTime",
......@@ -208,29 +214,40 @@ export default {
align: "left",
high: true,
hide: true,
type: 'user'
type: "user",
},
{
title: '操作',
key: 'action',
title: "操作",
key: "action",
width: 200,
align: 'center',
align: "center",
render: (h, params) => {
return h('div', {
class: "action"
}, [
h('op', {
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',
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
}
click: () =>
params.row.status == 0 || params.row.status == 2
? this.updatestatus(params.row.id, 1)
: null,
},
}),
h('op', {
h("op", {
attrs: {
icon: "ios-pause",
type: "icon",
......@@ -238,127 +255,134 @@ export default {
color: params.row.status == 1 ? "#19be6b" : "#ccc",
},
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: {
icon: "ios-close",
type: "icon",
title: params.row.status != 0 ? "完成" : "无法操作",
color: params.row.status != 0 ? "#19be6b" : "#ccc",
title: "完成"
},
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: {
icon: "md-add",
type: "icon",
title: params.row.status != 3 ? "新增记录" : "无法操作",
color: params.row.status != 3 ? "#19be6b" : "#ccc",
title: "工时汇报",
},
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: {
icon: "ios-create-outline",
type: "icon",
title: "修改",
color: "#2b85e4",
},
on: {
click: () => this.edit(params.row.id)
}
click: () => this.edit(params.row.id),
},
}),
h('op', {
h("op", {
attrs: {
icon: "ios-trash-outline",
type: "icon",
title: "删除",
color: "#ed4014",
oprate: "delete",
msg: "确认要删除吗?",
},
on: {
click: () => this.remove(params.row.id)
}
})
])
}
click: () => this.remove(params.row.id),
},
}),
]
);
},
},
],
data1: [{
data1: [
{
id: 1,
title: '测试title'
}]
}
title: "测试title",
},
],
};
},
mounted() {
console.log(this);
},
async fetch({
store,
params
}) {
await store.dispatch('loadDictionary') // 加载数据字典
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load()
this.modal = false
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch)
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.fullScreen = false;
this.detail = () => import('./add')
this.detail = () => import("./add");
this.modal = true;
},
highSearch() {
this.curId = 0;
this.title = "高级搜索";
this.fullScreen = false;
this.detail = () => import('./search')
this.detail = () => import("./search");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.fullScreen = false;
this.detail = () => import('./add')
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.fullScreen = false;
this.detail = () => import('./detail')
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.fullScreen = false;
this.detail = () => import('./edit')
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success('删除成功')
this.$Message.success("删除成功");
}
})
});
},
cancel() {
this.curId = 0;
this.modal = false
this.modal = false;
},
onHide() {
// this.$Message.info("收起左侧树")
......@@ -372,8 +396,8 @@ export default {
let where = {
bomId: {
op: "In",
value: ids
}
value: ids,
},
};
this.$refs.grid.reload(where);
},
......@@ -381,44 +405,46 @@ export default {
let params = {
id: valId,
status: valStatus,
detail: ''
}
Api.updatestatus(params).then(r => {
detail: "",
};
Api.updatestatus(params)
.then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success('操作成功')
this.$Message.success("操作成功");
} 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) {
this.$refs.grid.reload(this.easySearch)
this.$refs.grid.reload(this.easySearch);
},
viewRecord(id) {
this.curId = id;
this.title = "查看记录";
this.fullScreen = true;
this.detail = () => import('./detail')
this.detail = () => import("./detail");
this.modal = true;
},
addRecord(id) {
this.curId = id;
this.title = "新增记录";
this.fullScreen = true;
this.detail = () => import('../record/add')
this.detail = () => import("../record/add");
this.modal = true;
},
l(key) {
let vkey = "project_task" + "." + key;
return this.$t(vkey) || key
}
}
}
return this.$t(vkey) || key;
},
},
};
</script>
<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