Commit 52d3c7f2 authored by 周远喜's avatar 周远喜

ok

parent 3da3304b
......@@ -87,8 +87,10 @@ export default {
handleChange(date, t) {
if (date.length == 2) {
this.value3 = date;
this.value[this.start] = date[0];
this.value[this.end] = dayjs(date[1]).format("YYYY-MM-DD 23:59:59");
// this.value[this.start] = date[0];
// this.value[this.end] = dayjs(date[1]).format("YYYY-MM-DD 23:59:59");
this.$set(this.value,this.start,date[0])
this.$set(this.value,this.end,dayjs(date[1]).format("YYYY-MM-DD 23:59:59"))
this.$emit("on-change", this.value);
}
this.open = false;
......
......@@ -20,7 +20,11 @@
:style="tdStyle(column)"
>
<label v-if="column.type === 'selection'">
<Checkbox v-model="all"></Checkbox>
<Checkbox
v-model="checkAll"
@on-change="checked"
:indeterminate="indeterminate"
></Checkbox>
</label>
<label v-else>
{{ renderHeader(column, index) }}
......@@ -63,9 +67,12 @@
<!-- 多选 -->
<label
v-if="column.type === 'selection'"
@click="handleCheckClick(item, $event, index)"
@click="rowChecked(item, index, $event)"
>
<Checkbox v-model="item.checked"></Checkbox>
<Checkbox
v-model="item._checked"
:indeterminate="item._indeterminate"
></Checkbox>
</label>
<Icon v-if="column.type === 'drag'" type="md-more" class="drag" />
......@@ -96,7 +103,7 @@
<span @click="toggle(index, item)" v-if="snum == treeColumn()">
<span class="ib" v-width="spaceWidth * item._level"></span>
<a v-if="item._count > 0" class="expand"
><Icon :type="item._expanded ? 'ios-add' : 'ios-remove'" /> </a
><Icon :type="!item._expanded ? 'ios-add' : 'ios-remove'" /> </a
><i v-else class="ms-tree-space"></i> {{ item._level }}v{{
item._count
}}:{{ show(item) }}
......@@ -154,7 +161,7 @@ export default {
level: {
//展开层级
type: Number,
default: 0,
default: 1,
},
query: {
//参数
......@@ -179,21 +186,22 @@ export default {
return [];
},
},
rowKey: {
keyname: {
//默认行主键
type: [String],
default: "id",
},
upname: {
// 父级字段名称
type: String,
default: "upId",
},
root: {
// 根级UpId的值.
type: [String, Number],
default: 0,
},
parent: {
// 父级字段名称
type: String,
default: "upId",
},
iconName: false,
drag: {
//拖拽
......@@ -214,7 +222,7 @@ export default {
data() {
return {
color: "#19be6b",
all: true,
checkAll: false,
logs: [],
trs: [], // 处理后数据数组
cloneColumns: [], // 处理后的表头数据
......@@ -226,7 +234,14 @@ export default {
dragIndex: -1, //拖拽开始的序号
};
},
computed: {},
computed: {
indeterminate() {
var checkeds=this.trs.filter(u=>{
return u._checked;
}).length;
return 0<checkeds && checkeds<this.trs.length;
},
},
watch: {
items() {
if (this.items) {
......@@ -238,8 +253,8 @@ export default {
this.checks = false;
}
}
console.warn("tree", this.trs);
},
data(v) {},
columns: {
handler() {
this.cloneColumns = this.makeColumns();
......@@ -261,7 +276,6 @@ export default {
this.checks = false;
}
}
console.warn("tree", this.trs);
},
methods: {
slots() {
......@@ -280,12 +294,9 @@ export default {
} else if (this.dragIndex < index) {
tr.className += " sort";
}
// console.warn("进入",e, e.clientY,tr.clientTop, tr.className);
},
// 悬浮
dragover(e, index, row) {
// console.warn("悬浮",e)
e.preventDefault();
// 鼠标Y
var my = e.offsetY;
......@@ -311,7 +322,6 @@ export default {
if (index != this.dragIndex) {
this.$emit("on-drag-drop", this.dragIndex, index, this.trs, e);
}
console.log(e.offsetY / e.toElement.clientHeight);
},
/**
* @dragover="dragover($event, index, item)"
......@@ -375,11 +385,11 @@ export default {
toggle(index, item) {
if (item._count > 0) {
this.$set(this.trs[index], "_expanded", !item._expanded);
this.trs.forEach((u,i)=>{
if(u["upId"]===item.id){
this.trs.forEach((u, i) => {
if (u[this.upname] === item.id) {
this.$set(this.trs[i], "_show", !item._expanded);
}
})
});
}
console.warn(index, item._expanded, item);
},
......@@ -388,22 +398,23 @@ export default {
return true;
} else {
var parents = this.getRoots(item);
console.log(parents)
return parents.filter(u=>{
return !u._expanded
}).length==0;
return (
parents.filter((u) => {
return !u._expanded;
}).length == 0
);
}
},
getRoots(item){
getRoots(item) {
var parents = [];
var root=this.trs.filter(u=>{
return u["id"]==item["upId"];
})
while(root.length==1){
var root = this.trs.filter((u) => {
return u[this.keyname] == item[this.upname];
});
while (root.length == 1) {
parents.push(root[0]);
root=this.trs.filter(u=>{
return u["id"]===root["upId"];
})
root = this.trs.filter((u) => {
return u[this.keyname] === root[0][this.upname];
});
}
return parents;
},
......@@ -429,39 +440,39 @@ export default {
}
},
// 点击check勾选框,判断是否有children节点 如果有就一并勾选
handleCheckClick(data, event, index) {
data.isChecked = !data.isChecked;
const arr = data.children;
if (arr) {
if (data.isChecked) {
this.checkGroup.push(data.id);
for (let i = 0; i < arr.length; i++) {
this.checkGroup.push(arr[i].id);
}
} else {
for (let i = 0; i < this.checkGroup.length; i++) {
if (this.checkGroup[i] == data.id) {
this.checkGroup.splice(i, 1);
}
for (let j = 0; j < arr.length; j++) {
if (this.checkGroup[i] == arr[j].id) {
this.checkGroup.splice(i, 1);
}
}
rowChecked(data, index, event) {
var boys = this.getChildrens(data);
this.trs.forEach((u, i) => {
var items = boys.filter((b) => {
return b[this.keyname] == u[this.keyname];
});
if (items.length == 1) {
this.$set(this.trs[i], "_checked", !data._checked);
}
});
this.checkAll= this.trs.length>this.trs.filter(u=>{
return !u._checked;
}).length
},
getChildrens(data) {
var childrens = [];
var that=this;
getChildren(data);
function getChildren(f) {
that.trs.forEach(u=>{
if(u[that.upname]==f[that.keyname]){
childrens.push(u);
getChildren(u);
}
})
}
return childrens;
},
// checkbox 全选 选择事件
handleCheckAll() {
this.checks = !this.checks;
if (this.checks) {
this.checkGroup = this.getArray(
this.checkGroup.concat(this.All(this.items))
);
} else {
this.checkGroup = [];
}
checked(v) {
this.trs.forEach((u, i) => {
this.$set(this.trs[i], "_checked", v);
});
// this.$emit('on-selection-change', this.checkGroup)
},
// 数组去重
......@@ -511,9 +522,12 @@ export default {
let copy = that.$u.clone(u);
copy._count = 0;
copy._level = level;
copy._expanded = false;
copy._expanded = copy._expanded || that.level>level;
copy._show = true;
copy._indeterminate = false;
copy._checked = copy._checked || false;
list.push(copy);
if (u.children) {
treeToList(u.children, level + 1);
copy._count = u.children.length;
......@@ -609,9 +623,9 @@ export default {
font-size: 14px;
font-weight: bold;
}
.expand:hover{
.expand:hover {
background: @table_theme;
color:white;
color: white;
}
.ib {
display: inline-block;
......
<template>
<Poptip placement="bottom-start" trigger="hover" width="240" transfer>
<label :class="css">{{ user.name }}</label>
<label v-if="mode=='text'" :class="css">{{ user.name }}</label>
<Avatar v-else :style="{background:user.gender=='男'?'#1479D7':'red'}"
:icon="user.gender=='男'?'md-person':'md-woman'" shape="square" :src="img">{{user.name}}</Avatar>
<div slot="content">
<Avatar v-if="user.face" size="large" :src="img"></Avatar>
<Avatar
......@@ -31,6 +33,13 @@ export default {
type: [Number, String],
default: 0,
},
mode:{
type:String,
default:"text",
validator:(v)=>{
return ["text","face"].indexOf(v)>-1
}
}
},
data() {
return {
......
......@@ -2041,6 +2041,8 @@ document_category: {
startDate: '开始日期',
endDate: '结束日期',
businessUnits: '业务单位',
date: '计划日期',
users: '成员',
},
//项目任务
project_task: {
......
<template>
<div>
<Card>
<EditGrid :columns="columns" ref="grid" :items="list" :drag="true">
<EditGrid :columns="columns" ref="grid" :items="list" :level="8" :drag="true" >
<template slot="easySearch"
><Form ref="formInline" :model="easySearch" inline
><FormItem prop="keys"
......@@ -94,9 +94,9 @@ export default {
},
{
key: "upId",
width: 400,
title: this.l("upId"),
width: 50,
type:"selection",
align:'center'
},
{
key: "title",
......
......@@ -3,17 +3,18 @@
<div class="top-title">
<div class="new-detail row-left">
<Row>
<Filed :span="12" :name="l('title') + ':'">{{ entity.title }}</Filed>
<Filed :span="12" :name="l('state') + ':'">
<Filed :span="6" :name="l('title') + ':'">{{ entity.title }}</Filed>
<Filed :span="6" :name="l('state') + ':'">
<state code="project.main.state" :value="entity.state" />
</Filed>
<!-- <Filed :span="12" :name="l('phase')">{{ entity.phase }}</Filed> -->
<Filed :span="12" :name="l('startDate') + ':'">{{
entity.startDate
}}</Filed>
<Filed :span="12" :name="l('endDate') + ':'">{{
entity.endDate
}}</Filed>
<Filed :span="12" :name="l('date') + ':'">
<DateRange v-model="entity"/>
</Filed>
<Filed :span="24" :name="l('users')+ ':'">
<User :value="1" mode="face"/>
<a><Avatar icon="md-add" size="24" /></a>
</Filed>
</Row>
</div>
<ul>
......
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