Commit c44f2790 authored by renjintao's avatar renjintao

projectTaskTree task iview.js groupUser...

parent 56bd610e
<template>
<div class="flex fd tree-menu">
<h3>
任务结构
<div class="fr mr10 mt10">
<ButtonGroup class="fr" size="small">
<Button :icon="expand ? 'md-arrow-dropright' : 'md-arrow-dropdown'" @click="toggle" title="展开/合并"></Button>
<Button icon="md-refresh" title="刷新" @click="loadTree"></Button>
<Button icon="md-rewind" title="收起" @click="hide"></Button>
</ButtonGroup>
</div>
</h3>
<div class="search">
<Input search placeholder="请输入关键字" v-model="keys" clearable />
</div>
<div class="fg">
<div class="tree">
<Tree :data="data" :render="renderContent" ref="tree" @on-select-change="change"></Tree>
</div>
</div>
</div>
</template>
<script>
export default {
name: "",
data() {
return {
keys: "",
expand: true,
list: []
};
},
props: {
curId: {
type: String,
default: '',
},
},
created() {
this.loadTree();
},
methods: {
loadTree() {
let params = {
conditions: [{
fieldName: "projectId",
fieldValue: this.curId,
conditionalType: "Equal"
}]
}
this.$api.post(`${material}/projectplan/list`, params).then(r => {
var data = this.$u.toTree(
r.result,
null,
u => {
u.value = u.id;
u.expand = true;
u.selected = false;
u.checked = false;
},
"upId"
);
this.list = this.$u.clone(data);
});
},
toggle() {
this.expand = !this.expand;
},
renderContent(h, {
root,
node,
data
}) {
// let type = "md-folder";
// if (data.isProduct != 0) {
// type = "ios-image";
// }
return h("div", [
h("state", {
props: {
code: "mes.project_plan.Type",
type: "icon",
value: data.type + ""
}
}),
h(
"span", {
style: {
// color: data.isProduct == 0 ? "#000" : "rgba(38, 128, 235, 1)"
}
},
data.title
),
h("state", {
props: {
code: "mes.project_plan.Status",
type: "text",
value: data.status
}
}),
]);
},
change(v, b) {
// console.log(b);
let ids = [];
let productIds = [];
// if (b.bomId !== 0) {
// ids.push(b.bomId);
// }
var curentId = ''
curentId = b.id
productIds.push(b.value);
if (b.children) {
addId(b.children);
function addId(data) {
data.map(u => {
// if (u.bomId !== 0) {
// ids.push(u.bomId);
// }
productIds.push(u.value);
if (u.children) {
addId(u.children);
}
});
}
}
this.$emit("on-select", curentId, b, productIds);
},
hide() {
this.$emit("on-hide");
}
},
computed: {
data() {
let items = this.$u.clone(this.list);
let expand = this.expand;
let result = [];
search(this.keys, items);
function search(keys, data) {
data.map(u => {
if (keys.length < 2) {
u.expand = expand;
result.push(u);
} else {
u.expand = expand;
if (u.title.indexOf(keys) > -1) {
result.push(u);
} else if (u.children) {
search(keys, u.children);
}
}
});
}
return result;
}
},
watch: {
curId(v) {
if (v) {
this.loadTree();
}
},
},
};
</script>
<style lang="less">
@import "../../assets/css/custom.less";
.tree-menu {
h3 {
height: 50px;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: bold;
line-height: 50px;
color: @left-tree-header-color;
background: @left-tree-header-bg-color;
opacity: 1;
padding-left: 10px;
}
.search {
height: 50px;
padding: 5px 10px;
}
.fg {
flex: none;
// height:0;
overflow: auto;
padding-left: 10px;
}
.tree {
height: calc(100vh - 215px);
overflow: auto;
}
}
</style>
......@@ -3,7 +3,7 @@
<Table border :columns="columns" :data="list" ref="table" class="tableCommon" stripe>
<template slot-scope="{ row, index }" slot="userId">
<User v-if="edit != index" :value="row.userId"></User>
<UserSelect v-else ref="userSelected" v-model="cur.userId" />
<UserSelect v-else ref="userSelected" v-model="cur.userId" @on-change="changeUser" />
</template>
<template slot-scope="{ row, index }" slot="role">
<state v-if="edit != index" code="project.group.role" :value="row.role" type="text"></state>
......@@ -13,10 +13,12 @@
<state v-if="edit != index" code="project.group.status" :value="row.status" type="text"></state>
<Dictionary v-else code="project.group.status" v-model="cur.status"></Dictionary>
</template>
<!--
<template slot-scope="{ row, index }" slot="joindate">
<span v-if="edit != index" v-text="row.joindate"></span>
<DatePicker v-else v-model="cur.joindate" type="date" transfer placeholder="请选择加入日期" @on-change="getTime"></DatePicker>
</template>
-->
<template slot-scope="{ row, index }" slot="whour">
<span v-if="edit != index" v-text="row.whour"></span>
<InputNumber v-else type="text" v-model.trim="cur.whour" />
......@@ -31,7 +33,7 @@
</template>
<template slot-scope="{ row, index }" slot="note">
<span v-if="edit != index" v-text="row.note"></span>
<Input v-else type="text" v-model.trim="cur.note" />
<Input v-else type="text" v-model.trim="cur.note" :disabled="true" />
</template>
<template slot-scope="{ row, index }" slot="action">
<div v-if="edit != index" class="action">
......@@ -108,13 +110,13 @@ export default {
width: 150,
slot: 'status'
},
{
key: "joindate",
title: this.l("joindate"),
align: "center",
width: 180,
slot: 'joindate'
},
// {
// key: "joindate",
// title: this.l("joindate"),
// align: "center",
// width: 180,
// slot: 'joindate'
// },
{
key: "whour",
title: this.l("whour"),
......@@ -233,6 +235,9 @@ export default {
this.authorityCur = row.authority
this.edit = index
},
changeUser(val, item) {
this.cur.note = item
},
//选择权限
changeAuthority(val) {
if (this.authorityCur != 1 && this.authorityCount == 1 && val == 1) {
......
This diff is collapsed.
......@@ -81,18 +81,21 @@ export default {
},
props: {
v: Object,
eid: Number
eid: String,
pid: String,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
// if (this.eid != '' && this.eid != null) {
// this.load(this.eid);
// }
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
this.entity.projectId = this.eid;
this.entity.planId = this.pid;
this.entity.status = 0
Api.create(this.entity).then((r) => {
this.disabled = false;
......@@ -152,9 +155,9 @@ export default {
this.entity = this.$u.clone(this.v)
},
eid(v) {
if (v > 0) {
this.load(v);
}
//if (v != '' && v != null) {
// this.load(v);
//}
}
}
}
......
<template>
<Layout class="full">
<Sider hide-trigger v-if="showMenu" class="menu_side" width="300">
<ProductTree @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="展开">
......@@ -73,7 +73,7 @@
</template>
</DataGrid>
<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" :pid="planId" @on-close="cancel" @on-ok="ok" />
</Modal>
</Content>
</Layout>
......@@ -82,12 +82,10 @@
<script>
import Api from './api'
import Search from './search'
import ProductTree from "@/components/page/productTree.vue";
export default {
name: 'list',
components: {
Search,
ProductTree
},
head: {
title: "",
......@@ -106,6 +104,10 @@ export default {
projectId: {
op: "Equal",
value: ''
},
planId: {
op: "In",
value: []
}
},
theme1: 'light',
......@@ -301,7 +303,9 @@ export default {
id: 1,
title: '测试title'
}],
data: []
data: [],
planId: '', //当前计划Id
planIdsCur: []
}
},
async fetch({
......@@ -312,6 +316,7 @@ export default {
},
created() {
if (this.$route.params.id != '') {
this.projectId = this.$route.params.id
this.easySearch.projectId.value = this.$route.params.id
}
this.treeHeight = window.innerHeight - 150;
......@@ -327,10 +332,11 @@ export default {
this.curId = 0;
},
search() {
this.easySearch.planId.value = this.planIdsCur
this.$refs.grid.reload(this.easySearch)
},
add() {
this.curId = 0;
this.curId = this.projectId;
this.title = "新增";
this.fullScreen = false;
this.detail = () => import('./add')
......@@ -384,12 +390,18 @@ export default {
//this.$Message.info("展开左侧树")
this.showMenu = true;
},
productSearch(id, item, productIds, ids) {
productSearch(id, item, planIds) {
this.planId = item.selected ? id : '';
this.planIdsCur = item.selected ? planIds : []
let where = {
bomId: {
planId: {
op: "In",
value: ids
}
value: item.selected ? planIds : []
},
projectId: {
op: "Equal",
value: this.$route.params.id
},
};
this.$refs.grid.reload(where);
},
......
......@@ -62,6 +62,7 @@ import op from '@/components/page/opration.vue'
import ProductNumberSelect from '@/components/page/productNumberSelect.vue'
import ProductSelect from '@/components/page/productSelect.vue'
import ProductSelect1 from '@/components/page/productSelect1.vue'
import ProjectTaskTree from '@/components/page/projectTaskTree.vue'
import DTSpan from '@/components/page/dtSpan.vue'
import DTSearch from '@/components/page/dtSearch.vue'
import InputTime from '@/components/page/inputTime.vue'
......@@ -139,6 +140,7 @@ Vue.component("DepartmentSelect", DepartmentSelect)
Vue.component("ProductNumberSelect", ProductNumberSelect)
Vue.component("ProductSelect", ProductSelect)
Vue.component("ProductSelect1", ProductSelect1)
Vue.component("ProjectTaskTree",ProjectTaskTree)
Vue.component("DTSpan", DTSpan)
Vue.component("DTSearch", DTSearch)
Vue.component("InputTime", InputTime)
......
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