Commit 780421a2 authored by renjintao's avatar renjintao

editGrid

parent 39bec43f
...@@ -653,7 +653,7 @@ export default { ...@@ -653,7 +653,7 @@ export default {
// ); // );
// }); // });
tempCol.forEach((elem) => { tempCol.forEach((elem) => {
if (e[elem.key] && e[elem.key] != "" && e[elem.key] != null) { if ((e[elem.key] && e[elem.key] != "" && e[elem.key] != null) || e[elem.key] == 0) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。 //如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。
let codeArr = []; let codeArr = [];
let keyValue = e[elem.key]; let keyValue = e[elem.key];
......
<template> <template>
<div class="table-content1"> <div class="table-content1">
<div class="table-tools"> <div class="table-tools">
<div class="table-search"> <div class="table-search">
<slot name="easySearch"></slot> <slot name="easySearch"></slot>
...@@ -16,131 +16,58 @@ ...@@ -16,131 +16,58 @@
<table class="table-head"> <table class="table-head">
<thead> <thead>
<tr> <tr>
<th <th v-for="(column, index) in columns" :key="index" :style="tdStyle(column)">
v-for="(column, index) in columns"
:key="index"
:style="tdStyle(column)"
>
<label v-if="column.type === 'selection'"> <label v-if="column.type === 'selection'">
<Checkbox <Checkbox v-model="checkAll" @on-change="checked" :indeterminate="indeterminate"></Checkbox>
v-model="checkAll"
@on-change="checked"
:indeterminate="indeterminate"
></Checkbox>
</label> </label>
<label v-else> <label v-else>
{{ renderHeader(column, index) }} {{ renderHeader(column, index) }}
<span class="ivu-table-sort" v-if="column.sortable"> <span class="ivu-table-sort" v-if="column.sortable">
<Icon <Icon type="arrow-up-b" :class="{ on: column._sortType === 'asc' }" @click.native="handleSort(index, 'asc')" />
type="arrow-up-b" <Icon type="arrow-down-b" :class="{ on: column._sortType === 'desc' }" @click.native="handleSort(index, 'desc')" />
:class="{ on: column._sortType === 'asc' }"
@click.native="handleSort(index, 'asc')"
/>
<Icon
type="arrow-down-b"
:class="{ on: column._sortType === 'desc' }"
@click.native="handleSort(index, 'desc')"
/>
</span> </span>
</label> </label>
</th> </th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr <tr v-for="(item, index) in trs" :key="item.id" class="treetr" :id="'tr' + index" v-show="show(item)" :draggable="drag && !item._drag" @dragstart="dragstart($event, index, item)" @drop="dragdrop($event, index, item)" @dragenter="dragenter($event, index, item)" @dragover="dragover($event, index, item)" @dragleave="dragleave($event, index, item)">
v-for="(item, index) in trs"
:key="item.id"
class="treetr"
:id="'tr' + index"
v-show="show(item)"
:draggable="drag && !item._drag"
@dragstart="dragstart($event, index, item)"
@drop="dragdrop($event, index, item)"
@dragenter="dragenter($event, index, item)"
@dragover="dragover($event, index, item)"
@dragleave="dragleave($event, index, item)"
>
<!-- --> <!-- -->
<td <td v-for="(column, snum) in columns" :key="column.key" :style="tdStyle(column)">
v-for="(column, snum) in columns"
:key="column.key"
:style="tdStyle(column)"
>
<!-- 多选 --> <!-- 多选 -->
<label <label v-if="column.type === 'selection'" @click="rowChecked(item, index, $event)">
v-if="column.type === 'selection'" <Checkbox v-model="item._checked" :indeterminate="item._indeterminate"></Checkbox>
@click="rowChecked(item, index, $event)"
>
<Checkbox
v-model="item._checked"
:indeterminate="item._indeterminate"
></Checkbox>
</label> </label>
<Icon <Icon v-if="column.type === 'drag'" type="md-more" class="drag" />
v-if="column.type === 'drag'" <DTSpan v-if="column.type == 'date'" :value="item[column.key]" />
type="md-more" <User v-if="column.type == 'user'" :value="item[column.key]" />
class="drag" <div v-if="
/>
<DTSpan
v-if="column.type == 'date'"
:value="item[column.key]"
/>
<div v-if="column.type == 'user'">
<User :value="item[column.key]" />
</div>
<div
v-if="
column.type == 'users' && column.type == 'users' &&
item[column.key] && item[column.key] &&
item[column.key].length > 0 item[column.key].length > 0
" ">
> <User v-for="li in item[column.key]" :value="li" :key="li" class="ml10" />
<User
v-for="li in item[column.key]"
:value="li"
:key="li"
class="ml10"
/>
</div> </div>
<state <state v-if="column.code" :code="column.code" :value="item[column.key]" />
v-if="column.code"
:code="column.code"
:value="item[column.key]"
/>
<!-- 树图标 --> <!-- 树图标 -->
<span @click="toggle(index, item)" v-if="snum == treeColumn()"> <span @click="toggle(index, item)" v-if="snum == treeColumn()">
<span class="ib" v-width="spaceWidth * item._level"></span> <span class="ib" v-width="spaceWidth * item._level"></span>
<a v-if="item._count > 0" class="expand" <a v-if="item._count > 0" class="expand">
><Icon <Icon :type="!item._expanded ? 'ios-add' : 'ios-remove'" />
:type="!item._expanded ? 'ios-add' : 'ios-remove'" </a><i v-else class="ms-tree-space"></i>
/> </a
><i v-else class="ms-tree-space"></i>
</span> </span>
<!-- 菜单名称、排序、请求地址 --> <!-- 菜单名称、排序、请求地址 -->
<label <label v-if="
v-if="
!column.type && !column.type &&
!column.code && !column.code &&
!column.render && !column.render &&
!column.slot !column.slot
" ">
>
{{ renderBody(item, column) }} {{ renderBody(item, column) }}
</label> </label>
<table-expand <table-expand v-if="column.render && !column.type && !column.solt" :row="item" :column="column" :index="snum" :render="column.render"></table-expand>
v-if="column.render && !column.type && !column.solt" <column-slot v-if="column.slot" :row="item" :column="column" :index="snum"></column-slot>
:row="item"
:column="column"
:index="snum"
:render="column.render"
></table-expand>
<column-slot
v-if="column.slot"
:row="item"
:column="column"
:index="snum"
></column-slot>
</td> </td>
</tr> </tr>
</tbody> </tbody>
...@@ -150,43 +77,16 @@ ...@@ -150,43 +77,16 @@
<div class="table-footer"> <div class="table-footer">
<slot name="footer"></slot> <slot name="footer"></slot>
<Page <Page v-if="page" :total="search.total" :current="search.page" class="fr" show-total size="small" show-elevator show-sizer :page-size="search.pageSize" :page-size-opts="pageSizeOpts" @on-change="pageChange" @on-page-size-change="pageSizeChange" />
v-if="page"
:total="search.total"
:current="search.page"
class="fr"
show-total
size="small"
show-elevator
show-sizer
:page-size="search.pageSize"
:page-size-opts="pageSizeOpts"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>
</div> </div>
<Modal <Modal v-if="high" v-model="modalSearch" title="高级搜索" draggable width="800" ref="search">
v-if="high"
v-model="modalSearch"
title="高级搜索"
draggable
width="800"
ref="search"
>
<slot name="searchForm"></slot> <slot name="searchForm"></slot>
<div slot="footer"> <div slot="footer">
<Button @click="modalSearch = false" class="mr20">取消</Button> <Button @click="modalSearch = false" class="mr20">取消</Button>
<Button @click="complexSearch" type="primary" class="mr20">查询</Button> <Button @click="complexSearch" type="primary" class="mr20">查询</Button>
</div> </div>
</Modal> </Modal>
<Drawer <Drawer title="列设置" v-if="set" v-model="config" :scrollable="true" placement="left" :mask="false">
title="列设置"
v-if="set"
v-model="config"
:scrollable="true"
placement="left"
:mask="false"
>
<div slot="header"> <div slot="header">
列设置 列设置
<a @click="undoConfig" class="ml50"> <a @click="undoConfig" class="ml50">
...@@ -194,17 +94,9 @@ ...@@ -194,17 +94,9 @@
</a> </a>
</div> </div>
<ul class="table-columns"> <ul class="table-columns">
<li <li v-for="(li, index) in columnsCur" :key="index" v-dragging="{ item: li, list: columnsCur, group: 'li' }">
v-for="(li, index) in columnsCur"
:key="index"
v-dragging="{ item: li, list: columnsCur, group: 'li' }"
>
<label @click="columnChange(li, index)" :class="{ dis: li.hide }"> <label @click="columnChange(li, index)" :class="{ dis: li.hide }">
<Icon <Icon :type="li.hide ? 'md-eye-off' : 'md-eye'" size="16" class="mr10" />
:type="li.hide ? 'md-eye-off' : 'md-eye'"
size="16"
class="mr10"
/>
<span>{{ li.title }}</span> <span>{{ li.title }}</span>
</label> </label>
<Icon type="ios-move" class="move" size="18" /> <Icon type="ios-move" class="move" size="18" />
...@@ -216,14 +108,18 @@ ...@@ -216,14 +108,18 @@
<slot name="batch"></slot> <slot name="batch"></slot>
<Button @click="cancelBatch">取消</Button> <Button @click="cancelBatch">取消</Button>
</FooterToolbar> </FooterToolbar>
</div> </div>
</template> </template>
<script> <script>
import TableExpand from "./expand"; import TableExpand from "./expand";
import ColumnSlot from "./columnSolt"; import ColumnSlot from "./columnSolt";
export default { export default {
name: "treeGrid", name: "treeGrid",
components: { TableExpand, ColumnSlot }, components: {
TableExpand,
ColumnSlot
},
props: { props: {
mode: { mode: {
type: [String, Number], type: [String, Number],
...@@ -301,14 +197,14 @@ export default { ...@@ -301,14 +197,14 @@ export default {
items: { items: {
//接收树形数据 //接收树形数据
type: Array, type: Array,
default() { default () {
return []; return [];
}, },
}, },
data: { data: {
//接收UpId型数据 //接收UpId型数据
type: Array, type: Array,
default() { default () {
return []; return [];
}, },
}, },
...@@ -395,6 +291,7 @@ export default { ...@@ -395,6 +291,7 @@ export default {
timer: false, // 控制监听时长 timer: false, // 控制监听时长
dataLength: 0, // 树形数据长度 dataLength: 0, // 树形数据长度
dragIndex: -1, //拖拽开始的序号 dragIndex: -1, //拖拽开始的序号
allUser: [], //所有user
}; };
}, },
computed: { computed: {
...@@ -427,8 +324,12 @@ export default { ...@@ -427,8 +324,12 @@ export default {
checkGroup(data) { checkGroup(data) {
this.checkAllGroupChange(data); this.checkAllGroupChange(data);
}, },
exportTitle(v) {
this.exportTitle = v
}
}, },
mounted() { mounted() {
this.getAllUser(); //获取所有用户
if (this.items && this.items.length > 0) { if (this.items && this.items.length > 0) {
this.trs = this.treeToList(this.items); this.trs = this.treeToList(this.items);
this.columnsCur = this.makeColumns(); this.columnsCur = this.makeColumns();
...@@ -520,6 +421,9 @@ export default { ...@@ -520,6 +421,9 @@ export default {
if (column.width) { if (column.width) {
style["width"] = `${column.width}px`; style["width"] = `${column.width}px`;
} }
if (column.hide) {
style["display"] = `none`;
}
return style; return style;
}, },
// 排序事件 // 排序事件
...@@ -633,6 +537,7 @@ export default { ...@@ -633,6 +537,7 @@ export default {
var childrens = []; var childrens = [];
var that = this; var that = this;
getChildren(data); getChildren(data);
function getChildren(f) { function getChildren(f) {
that.trs.forEach((u) => { that.trs.forEach((u) => {
if (u[that.upname] == f[that.keyname]) { if (u[that.upname] == f[that.keyname]) {
...@@ -692,6 +597,7 @@ export default { ...@@ -692,6 +597,7 @@ export default {
treeToList(tree) { treeToList(tree) {
var that = this; var that = this;
let list = []; let list = [];
function treeToList(data, level) { function treeToList(data, level) {
data.map((u) => { data.map((u) => {
let copy = that.$u.clone(u); let copy = that.$u.clone(u);
...@@ -768,10 +674,185 @@ export default { ...@@ -768,10 +674,185 @@ export default {
this.footerToolbar = false; this.footerToolbar = false;
this.$refs.table.selectAll(false); this.$refs.table.selectAll(false);
}, },
//导出excel
export2Excel() {
//当前显示数据
let list = [];
list = this.trs;
const tHeader = []; // 设置Excel的表格第一行的标题
const filterVal = []; //list里对象的属性
var tempCol = [];
var tempCol1 = []; //存放物料相关表头
var tempCol2 = []; //存放工艺规程相关表头
var tempColUser = []; //存放type=user的表头
var tempColUsers = []; //存放type=users的表头
var columnsCur = this.$u.clone(this.columns); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => {
if (el.export) {
if (el.code) {
tempCol.push({
key: el.key,
code: el.code,
}); //临时存放code数据字典的字段及对应的数据字典code
}
if (el.materialKey) {
tempCol1.push({
key: el.key,
code: el.materialKey,
}); //临时存放物料管理大类和子类列表
}
if (el.techKey) {
tempCol2.push({
key: el.key,
code: el.techKey,
}); //临时存放工艺规程相关转换
}
if (el.type && el.type == "user") {
tempColUser.push({
key: el.key,
code: el.type,
}); //临时存放user列
}
if (el.type && el.type == "users") {
tempColUsers.push({
key: el.key,
code: el.type,
}); //临时存放user列
}
tHeader.push(el.title);
filterVal.push(el.key);
}
});
list.forEach((e) => {
tempCol.forEach((elem) => {
if ((e[elem.key] && e[elem.key] != "" && e[elem.key] != null) || e[elem.key] == 0) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。
let codeArr = [];
let keyValue = e[elem.key];
if (
keyValue.length > 0 &&
(keyValue.indexOf(",") > -1 || keyValue.indexOf(",") > -1)
) {
//如果对应的数据包含多个数据字典项,比如包含“,”或“,”
if (keyValue.indexOf(",") > -1) {
codeArr = keyValue.split(",");
}
if (keyValue.indexOf > -1) {
codeArr = keyValue.split(",");
}
}
if (codeArr.length <= 1) {
//对应的数据包含一个数据字典项
e[elem.key] = this.$u.dirName(
this.$store.getters.dictionaryByKey(elem.code),
e[elem.key]
);
} else {
//对应的数据包含多个数据字典项
let codeInfo = "";
codeArr.forEach((el) => {
codeInfo =
codeInfo +
this.$u.dirName(
this.$store.getters.dictionaryByKey(elem.code),
el
) +
",";
});
e[elem.key] = codeInfo.substr(0, codeInfo.length - 1);
}
}
});
//导出数据增加对应的物料管理信息 code: 1【rootCategoryId 大类】 2【categoryId 大类】 3【codeRuleId 编码名称】
tempCol1.forEach((elcol1) => {
if (elcol1.code == 1) {
e[elcol1.key] = this.getType1(e[elcol1.key]);
} else if (elcol1.code == 2) {
e[elcol1.key] = this.getType2(e[elcol1.key]);
} else if (elcol1.code == 3) {
e[elcol1.key] = this.getType3(e[elcol1.key]);
}
});
//导出工艺规程相关转换表头信息
tempCol2.forEach((elcol2) => {
if (elcol2.code == 1) {
e[elcol2.key] = this.getRoutingHeaderName(e[elcol2.key]);
}
});
//导出username相关信息
tempColUser.forEach((eluser) => {
if (Array.isArray(e[eluser.key]) && e[eluser.key].length > 0) {
let temUsers = this.$u.clone(e[eluser.key])
let temUserName = ''
temUsers.forEach(u => {
temUserName = temUserName + this.getUserName(u);
})
e[eluser.key] = temUserName
}
if (e[eluser.key] && typeof (e[eluser.key]) == 'string' && e[eluser.key] != "" && e[eluser.key] != null) {
e[eluser.key] = this.getUserName(e[eluser.key]);
}
});
tempColUsers.forEach((elusers) => {
if (e[elusers.key].length > 0) {
let temUsers = this.$u.clone(e[elusers.key])
let temUserName = ''
temUsers.forEach(u => {
temUserName = temUserName + this.getUserName(u) + ',';
})
e[elusers.key] = temUserName.substr(0, temUserName.length - 1)
}
});
});
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
//获取导出数据结束
this.$nextTick(() => {
this.$u.outExcel(
this.exportTitle + "(" + nowDate + ")",
tHeader,
filterVal,
list
);
})
}, },
//获取所有用户信息
getAllUser() {
this.$api
.post(`${systemUrl}/user/paged`, {
conditions: [],
pageIndex: 1,
pageSize: 100000,
})
.then((r) => {
if (r.success) {
let tempUserInfo = r.result.items;
tempUserInfo.forEach((ele) => {
let temObj = {
userId: ele.id,
name: ele.userName,
};
this.allUser.push(temObj);
});
}
});
},
getUserName(id) {
let name = "";
this.allUser.forEach((ele) => {
if (id == ele.userId) {
name = ele.name;
}
});
return name;
},
},
}; };
</script> </script>
<style lang="less"> <style lang="less">
@import "../../../assets/css/custom.less"; @import "../../../assets/css/custom.less";
@table_theme: #2680eb; @table_theme: #2680eb;
...@@ -779,6 +860,7 @@ export default { ...@@ -779,6 +860,7 @@ export default {
@table_line_height: 50px; @table_line_height: 50px;
@table_hover: #f2f8fe; @table_hover: #f2f8fe;
@table_border: #accef7; @table_border: #accef7;
.table-content1 { .table-content1 {
position: relative; position: relative;
height: 100%; height: 100%;
...@@ -788,19 +870,23 @@ export default { ...@@ -788,19 +870,23 @@ export default {
.table-tools { .table-tools {
line-height: 40px; line-height: 40px;
background: @right-header-bg; background: @right-header-bg;
.table-search { .table-search {
float: left; float: left;
line-height: 40px; line-height: 40px;
min-width: 300px; min-width: 300px;
} }
.btns { .btns {
float: right; float: right;
line-height: 40px; line-height: 40px;
} }
tr:hover { tr:hover {
background: #f7f7f7; background: #f7f7f7;
} }
} }
.icon-set { .icon-set {
font-size: 17px; font-size: 17px;
margin-left: 5px; margin-left: 5px;
...@@ -810,15 +896,18 @@ export default { ...@@ -810,15 +896,18 @@ export default {
.icon-set .ivu-icon { .icon-set .ivu-icon {
cursor: pointer; cursor: pointer;
} }
table { table {
border-spacing: 0; border-spacing: 0;
border-collapse: collapse; border-collapse: collapse;
margin: 0 auto; margin: 0 auto;
width: 100%; width: 100%;
border: 1px solid @table_border; border: 1px solid @table_border;
th { th {
background: @table_head; background: @table_head;
} }
td, td,
th { th {
border-left: @table_border solid 1px; border-left: @table_border solid 1px;
...@@ -830,6 +919,7 @@ export default { ...@@ -830,6 +919,7 @@ export default {
.drag:hover { .drag:hover {
cursor: move; cursor: move;
} }
.expand { .expand {
width: 18px; width: 18px;
height: 18px; height: 18px;
...@@ -839,33 +929,41 @@ export default { ...@@ -839,33 +929,41 @@ export default {
font-size: 14px; font-size: 14px;
font-weight: bold; font-weight: bold;
} }
.expand:hover { .expand:hover {
background: @table_theme; background: @table_theme;
color: white; color: white;
} }
.ib { .ib {
display: inline-block; display: inline-block;
} }
} }
th { th {
border-top: @table_border solid 1px; border-top: @table_border solid 1px;
} }
tr.treetr:hover td { tr.treetr:hover td {
background: @table_hover; background: @table_hover;
} }
tr.move { tr.move {
td { td {
background-color: #d3e6fb; background-color: #d3e6fb;
} }
} }
tr.sort { tr.sort {
td { td {
border-top: 2px solid #3b8ded; border-top: 2px solid #3b8ded;
} }
} }
tbody { tbody {
border-bottom: @table_border solid 1px; border-bottom: @table_border solid 1px;
} }
.ms-tree-space { .ms-tree-space {
position: relative; position: relative;
top: 1px; top: 1px;
......
<template> <template>
<div> <div>
<Card> <Card>
<EditGrid <EditGrid :columns="columns" ref="grid" :items="list" :level="8" :drag="true" :exportTitle="exportTl">
:columns="columns" <template slot="easySearch">
ref="grid" <Form ref="formInline" :model="easySearch" inline>
:items="list" <FormItem prop="keys"><Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" />
:level="8"
:drag="true"
>
<template slot="easySearch"
><Form ref="formInline" :model="easySearch" inline
><FormItem prop="keys"
><Input
placeholder="请输入关键字标题"
v-model="easySearch.keys.value"
/>
</FormItem> </FormItem>
<FormItem <FormItem><Button type="primary" @click="search">查询</Button>
><Button type="primary" @click="search">查询</Button>
</FormItem> </FormItem>
</Form></template </Form>
> </template>
<!-- <template slot="searchForm"> <!-- <template slot="searchForm">
<Search /> <Search />
</template> --> </template> -->
...@@ -31,36 +20,23 @@ ...@@ -31,36 +20,23 @@
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem name="saveTemplate">存为模版</DropdownItem> <DropdownItem name="saveTemplate">存为模版</DropdownItem>
<DropdownItem name="useTemplate">导入模版</DropdownItem> <DropdownItem name="useTemplate">导入模版</DropdownItem>
<DropdownItem name="down" disabled> <DropdownItem name="down">
<Icon <Icon type="md-cloud-download" class="mr10" />导出Excel
type="md-cloud-download" </DropdownItem>
class="mr10" <DropdownItem name="importExcel" disabled>
<Icon type="md-cloud-upload" class="mr10" />导入Excel
/>导出Excel</DropdownItem </DropdownItem>
>
<DropdownItem name="importExcel"
disabled
><Icon
type="md-cloud-upload"
class="mr10"
/>导入Excel</DropdownItem
>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</template> </template>
</EditGrid> </EditGrid>
</Card> </Card>
<Modal v-model="modal" :title="title" width="1200" footer-hide> <Modal v-model="modal" :title="title" width="1200" footer-hide>
<component <component :is="detail" :eid="curId" :v="row" @on-close="cancel" @on-ok="ok" />
:is="detail"
:eid="curId"
:v="row"
@on-close="cancel"
@on-ok="ok"
/>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import Search from "./search"; import Search from "./search";
...@@ -94,36 +70,28 @@ export default { ...@@ -94,36 +70,28 @@ export default {
row: {}, row: {},
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { op: "title", value: null }, keys: {
op: "title",
value: null
},
}, },
modal: false, modal: false,
title: "新增", title: "新增",
exportTl: '项目目录',
detail: null, detail: null,
curId: null, curId: null,
list: [], list: [],
columns: [ columns: [{
// { key:"id",title:this.$t("id") ,hide:true ,align:"left" ,high:true }, key: "drag",
// { key:"creationTime",title:this.l("creationTime") ,align:"left" ,high:true }, type: "drag",
// { key:"creatorUserId",title:this.l("creatorUserId") ,align:"left" ,high:true }, width: 50,
// { key:"lastModificationTime",title:this.l("lastModificationTime") ,align:"left" ,high:true }, align: 'center'
// { key:"lastModifierUserId",title:this.l("lastModifierUserId") ,align:"left" ,high:true },
// { key:"isDeleted",title:this.l("isDeleted") ,align:"left" ,high:true },
// { key:"deletionTime",title:this.l("deletionTime") ,align:"left" ,high:true },
// { key:"deleterUserId",title:this.l("deleterUserId") ,align:"left" ,high:true },
// { key:"projectId",title:this.l("projectId") ,align:"left" ,high:true },
// { key:"upId",title:this.l("upId") ,align:"left" ,high:true },
// { type: "selection", width: 80, align: "center" },
{
key:"drag",
type:"drag",
width:50,
align:'center'
}, },
{ {
key: "upId", key: "upId",
width: 50, width: 50,
type:"selection", type: "selection",
align:'center' align: 'center'
}, },
{ {
key: "title", key: "title",
...@@ -132,6 +100,7 @@ export default { ...@@ -132,6 +100,7 @@ export default {
tree: true, tree: true,
easy: true, easy: true,
high: true, high: true,
export: true,
}, },
{ {
key: "type", key: "type",
...@@ -143,6 +112,7 @@ export default { ...@@ -143,6 +112,7 @@ export default {
attr: { attr: {
type: "icon", type: "icon",
}, },
export: true,
}, },
{ {
key: "direction", key: "direction",
...@@ -152,8 +122,8 @@ export default { ...@@ -152,8 +122,8 @@ export default {
width: 80, width: 80,
easy: true, easy: true,
high: true, high: true,
export: true,
}, },
{ {
key: "status", key: "status",
title: this.l("status"), title: this.l("status"),
...@@ -161,17 +131,22 @@ export default { ...@@ -161,17 +131,22 @@ export default {
width: 80, width: 80,
high: true, high: true,
code: "mes.project_plan.Status", code: "mes.project_plan.Status",
export: true,
},
{
key: "startDate",
title: "计划开始日期",
hide: true,
export: true,
}, },
// {
// key: "startDate",
// title: this.l("startDate"),
// align: "left",
// high: true
// ,type:"date"
// },
// { key: "endDate", title: this.l("endDate"), align: "left", high: true,type:"date" },
{ {
key: "endDate", key: "endDate",
title: "计划结束日期",
hide: true,
export: true,
},
{
key: "dateRange",
width: 250, width: 250,
title: "计划日期", title: "计划日期",
align: "center", align: "center",
...@@ -183,18 +158,13 @@ export default { ...@@ -183,18 +158,13 @@ export default {
}); });
}, },
}, },
// {
// key: "attachment",
// title: this.l("attachment"),
// align: "left",
// high: true,
// },
{ {
key: "executor", key: "executor",
title: this.l("executor"), title: this.l("executor"),
align: "left", align: "left",
high: true, high: true,
type: "users", type: "users",
export: true,
}, },
{ {
key: "deliverable", key: "deliverable",
...@@ -204,28 +174,17 @@ export default { ...@@ -204,28 +174,17 @@ export default {
align: "center", align: "center",
easy: true, easy: true,
high: true, high: true,
export: true,
}, },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
width: 150, width: 150,
align: "center", align: "center",
// render:(h,params)=>{
// return h("Actions"
// ,{
// attrs:{
// row:params,
// },
// on:{
// 'on-click':this.rowclick
// }
// }
// )
// }
render: (h, params) => { render: (h, params) => {
return h("div", { class: "action" }, [ return h("div", {
class: "action"
}, [
h("op", { h("op", {
attrs: { attrs: {
icon: "md-arrow-dropright-circle", icon: "md-arrow-dropright-circle",
...@@ -234,7 +193,9 @@ export default { ...@@ -234,7 +193,9 @@ export default {
oprate: "edit", oprate: "edit",
disable: params.row.status != 0, disable: params.row.status != 0,
}, },
on: { click: () => this.send(params.row) }, on: {
click: () => this.send(params.row)
},
}), }),
h("op", { h("op", {
attrs: { attrs: {
...@@ -244,7 +205,9 @@ export default { ...@@ -244,7 +205,9 @@ export default {
disable: params.row.status > 1, disable: params.row.status > 1,
oprate: "edit", oprate: "edit",
}, },
on: { click: () => this.add(params.row) }, on: {
click: () => this.add(params.row)
},
}), }),
h("op", { h("op", {
attrs: { attrs: {
...@@ -254,7 +217,9 @@ export default { ...@@ -254,7 +217,9 @@ export default {
oprate: "edit", oprate: "edit",
disable: params.row.status !== 0, disable: params.row.status !== 0,
}, },
on: { click: () => this.edit(params.row) }, on: {
click: () => this.edit(params.row)
},
}), }),
h("op", { h("op", {
attrs: { attrs: {
...@@ -265,7 +230,9 @@ export default { ...@@ -265,7 +230,9 @@ export default {
disable: params.row.status !== 0, disable: params.row.status !== 0,
msg: "确认要删除吗?", msg: "确认要删除吗?",
}, },
on: { click: () => this.remove(params.row.id) }, on: {
click: () => this.remove(params.row.id)
},
}), }),
]); ]);
}, },
...@@ -277,7 +244,10 @@ export default { ...@@ -277,7 +244,10 @@ export default {
console.log(this); console.log(this);
this.search(); this.search();
}, },
async fetch({ store, params }) { async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
}, },
methods: { methods: {
...@@ -289,13 +259,11 @@ export default { ...@@ -289,13 +259,11 @@ export default {
search() { search() {
// this.$refs.grid.reload(this.easySearch); // this.$refs.grid.reload(this.easySearch);
var params = { var params = {
conditions: [ conditions: [{
{
fieldName: "projectId", fieldName: "projectId",
conditionalType: "Equal", conditionalType: "Equal",
fieldValue: this.eid, fieldValue: this.eid,
}, }, ],
],
// conditions: [] // conditions: []
}; };
Api.list(params).then((r) => { Api.list(params).then((r) => {
...@@ -390,25 +358,29 @@ export default { ...@@ -390,25 +358,29 @@ export default {
this.curId = null; this.curId = null;
this.modal = false; this.modal = false;
}, },
show(name){ show(name) {
var that=this; var that = this;
var m= { var m = {
saveTemplate(name){ saveTemplate(name) {
that.curId = that.eid; that.curId = that.eid;
that.row = that.data; that.row = that.data;
that.title = "保存模版"; that.title = "保存模版";
that.detail = () => import("./saveTemplate"); that.detail = () => import("./saveTemplate");
that.modal = true; that.modal = true;
}, },
useTemplate(name){ useTemplate(name) {
that.curId = that.eid; that.curId = that.eid;
that.row = that.data; that.row = that.data;
that.title = "导入模版"; that.title = "导入模版";
that.detail = () => import("./importTemplate"); that.detail = () => import("./importTemplate");
that.modal = true; that.modal = true;
},
} }
if (name == 'down') {
this.exportTl = '项目目录-' + this.data.title;
this.$refs.grid.export2Excel()
} }
m[name]&&m[name](name); m[name] && m[name](name);
}, },
l(key) { l(key) {
...@@ -418,5 +390,6 @@ export default { ...@@ -418,5 +390,6 @@ export default {
}, },
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</div> </div>
<div class="mt50 pl10"> <div class="mt50 pl10">
<h2>Bmenu</h2> <h2>Bmenu</h2>
<div @contextmenu="showBmenu" class="tc" style="width:120px;height:40px;line-height:40px;background:#f5f5f5;border:#ccc solid 1px; border-radius: 5px;">{{message}}</div> <div @contextmenu="onCon" class="tc" style="width:120px;height:40px;line-height:40px;background:#f5f5f5;border:#ccc solid 1px; border-radius: 5px;">{{message}}</div>
</div> </div>
</div> </div>
</template> </template>
......
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