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

ok

parent 15a0c384
...@@ -21,9 +21,7 @@ ul, ...@@ -21,9 +21,7 @@ ul,
li { li {
list-style: none; list-style: none;
} }
.ivu-drawer-wrap{
z-index: 12000;
}
div::-webkit-scrollbar { div::-webkit-scrollbar {
width: 10px; width: 10px;
height: 10px; height: 10px;
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
background-color: @primary-color; background-color: @primary-color;
border-color: @primary-color; border-color: @primary-color;
} }
.ivu-drawer-wrap,.tree-drawer{
z-index: 12000;
}
.ivu-btn-group:not(.ivu-btn-group-vertical) .ivu-btn-primary:first-child:not(:last-child) { .ivu-btn-group:not(.ivu-btn-group-vertical) .ivu-btn-primary:first-child:not(:last-child) {
border-right-color: @primary-color; border-right-color: @primary-color;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<thead> <thead>
<tr> <tr>
<th <th
v-for="(column, index) in columns" v-for="(column, index) in columnNow"
:key="index" :key="index"
:style="tdStyle(column)" :style="tdStyle(column)"
> >
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
> >
<!-- --> <!-- -->
<td <td
v-for="(column, snum) in columns" v-for="(column, snum) in columnNow"
:key="column.key" :key="column.key"
:style="tdStyle(column)" :style="tdStyle(column)"
> >
...@@ -75,7 +75,6 @@ ...@@ -75,7 +75,6 @@
v-model="item._checked" v-model="item._checked"
:indeterminate="item._indeterminate" :indeterminate="item._indeterminate"
></Checkbox> ></Checkbox>
{{ item._checked }}
</label> </label>
<Icon <Icon
...@@ -148,7 +147,6 @@ ...@@ -148,7 +147,6 @@
</table> </table>
</div> </div>
</div> </div>
<div class="table-footer"> <div class="table-footer">
<slot name="footer"></slot> <slot name="footer"></slot>
<Page <Page
...@@ -190,9 +188,9 @@ ...@@ -190,9 +188,9 @@
> >
<div slot="header"> <div slot="header">
列设置 列设置
<a @click="undoConfig" class="ml50"> <!-- <a @click="undoConfig" class="ml50">
<Icon type="md-refresh" title="恢复初始设置" /> <Icon type="md-refresh" title="恢复初始设置" />
</a> </a> -->
</div> </div>
<ul class="table-columns"> <ul class="table-columns">
<li <li
...@@ -396,11 +394,12 @@ export default { ...@@ -396,11 +394,12 @@ export default {
columnsCur: [], // 处理后的表头数据 columnsCur: [], // 处理后的表头数据
checkGroup: [], // 复选框数组 checkGroup: [], // 复选框数组
checks: false, // 全选 checks: false, // 全选
tdsWidth: 0, // td总宽
timer: false, // 控制监听时长 timer: false, // 控制监听时长
dataLength: 0, // 树形数据长度 dataLength: 0, // 树形数据长度
dragIndex: -1, //拖拽开始的序号 dragIndex: -1, //拖拽开始的序号
allUser: [], //所有user allUser: [], //所有user
userConfig: null,
userId: this.$store.state.userInfo.userId,
}; };
}, },
computed: { computed: {
...@@ -410,6 +409,14 @@ export default { ...@@ -410,6 +409,14 @@ export default {
}).length; }).length;
return 0 < checkeds && checkeds < this.trs.length; return 0 < checkeds && checkeds < this.trs.length;
}, },
columnNow() {
// return this.columnsCur;
var now=this.columnsCur.filter((u) => {
return !u.hide||u.hide==false;
});
console.log("cols",now,this.columnsCur,this.columns)
return now;
},
}, },
watch: { watch: {
items() { items() {
...@@ -428,11 +435,12 @@ export default { ...@@ -428,11 +435,12 @@ export default {
this.exportTitle = v; this.exportTitle = v;
}, },
}, },
created(){
this.columnsCur = this.makeColumns();
},
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();
} }
}, },
methods: { methods: {
...@@ -498,8 +506,8 @@ export default { ...@@ -498,8 +506,8 @@ export default {
// 有无多选框折叠位置优化 // 有无多选框折叠位置优化
treeColumn() { treeColumn() {
var num = 0; var num = 0;
for (let i = 0, len = this.columns.length; i < len; i++) { for (let i = 0, len = this.columnNow.length; i < len; i++) {
if (this.columns[i].tree) { if (this.columnNow[i].tree) {
num = i; num = i;
} }
} }
...@@ -542,13 +550,6 @@ export default { ...@@ -542,13 +550,6 @@ export default {
// 处理表头数据 // 处理表头数据
makeColumns() { makeColumns() {
const columns = this.$u.clone(this.columns); const columns = this.$u.clone(this.columns);
this.tdsWidth = 0;
columns.forEach((column, index) => {
column._index = index;
column._width = column.width ? column.width : "";
column._sortType = "normal";
this.tdsWidth += column.width ? parseFloat(column.width) : 0;
});
return columns; return columns;
}, },
// // 隐藏显示 // // 隐藏显示
...@@ -588,35 +589,13 @@ export default { ...@@ -588,35 +589,13 @@ export default {
} }
return parents; return parents;
}, },
open(index, item) {
if (item.children) {
item.children.forEach((child, childIndex) => {
child.isShow = true;
if (child.children && child.expanded) {
this.open(index + childIndex + 1, child);
}
});
}
},
close(index, item) {
if (item.children) {
item.children.forEach((child, childIndex) => {
child.isShow = false;
child.expanded = false;
if (child.children) {
this.close(index + childIndex + 1, child);
}
});
}
},
// 点击check勾选框,判断是否有children节点 如果有就一并勾选 // 点击check勾选框,判断是否有children节点 如果有就一并勾选
rowChecked(data, index, event) { rowChecked(data, index, event) {
// this.$set(this.trs, index, data); this.$set(this.trs, index, data);
console.log("rowChecked",data,this.trs[index])
var boys = this.getChildrens(data); var boys = this.getChildrens(data);
if(boys.length){ if (boys.length>0) {
this.trs.forEach((u, i) => {
}
this.trs.forEach((u, i) => {
var items = boys.filter((b) => { var items = boys.filter((b) => {
return b[this.keyname] == u[this.keyname]; return b[this.keyname] == u[this.keyname];
}); });
...@@ -624,6 +603,8 @@ export default { ...@@ -624,6 +603,8 @@ export default {
this.$set(this.trs[i], "_checked", !data._checked); this.$set(this.trs[i], "_checked", !data._checked);
} }
}); });
}
this.checkAll = this.checkAll =
this.trs.length > this.trs.length >
this.trs.filter((u) => { this.trs.filter((u) => {
...@@ -658,12 +639,12 @@ export default { ...@@ -658,12 +639,12 @@ export default {
}, },
selectionChange() { selectionChange() {
var items = this.trs.filter((u) => { var items = this.trs.filter((u) => {
return u._checked === true; return u._checked;
}); });
this.selectItems = items; this.selectItems = items;
this.$emit("on-selection-change", items, this.trs); this.$emit("on-selection-change", items, this.trs);
this.footerToolbar = items.length > 0; this.footerToolbar = items.length > 0;
console.log("footerToolbar", items, this.trs); console.log("footerToolbar", items);
}, },
// 数组去重 // 数组去重
getArray(a) { getArray(a) {
...@@ -740,205 +721,42 @@ export default { ...@@ -740,205 +721,42 @@ export default {
columnChange(item, i) { columnChange(item, i) {
item.hide = !item.hide; item.hide = !item.hide;
this.$set(this.columnsCur, item, i); this.$set(this.columnsCur, item, i);
this.saveUserconfig(); // this.saveUserconfig();
},
onSelect(rows, row) {
this.$emit("on-change", rows, row);
},
allChange(items) {
this.$emit("all-change", items);
}, },
undoConfig() { undoConfig() {
//列设置恢复初始化 //列设置恢复初始化
this.columnsCur = this.$u.clone(this.columns); this.columnsCur = this.$u.clone(this.columns);
// this.saveUserconfig(); // this.saveUserconfig();
}, },
//批量取消 saveUserconfig() {
cancelBatch() { let url = `${window.systemUrl}/config/update`;
this.footerToolbar = false; var content = [];
// this.$refs.table.selectAll(false); this.columnsCur.map((u) => {
}, content.push({
//导出excel key: u.key,
export2Excel() { hide: u.hide,
//当前显示数据
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
);
}); });
}, if (!this.userConfig) {
//获取所有用户信息 url = `${window.systemUrl}/config/create`;
getAllUser() { var data = {
this.$api page: window.location.pathname,
.post(`${systemUrl}/user/paged`, { component: "Grid",
conditions: [], key: this.$u.guid(),
pageIndex: 1, content: JSON.stringify(content),
pageSize: 100000, };
}) this.$api.post(url, data).then((r) => {
.then((r) => { this.loadUserConfig();
if (r.success) {
let tempUserInfo = r.result.items;
tempUserInfo.forEach((ele) => {
let temObj = {
userId: ele.id,
name: ele.userName,
};
this.allUser.push(temObj);
});
}
}); });
} else {
this.userConfig.content = JSON.stringify(content);
this.$api.post(url, this.userConfig);
}
}, },
getUserName(id) { //批量取消
let name = ""; cancelBatch() {
this.allUser.forEach((ele) => { this.footerToolbar = false;
if (id == ele.userId) { // this.$refs.table.selectAll(false);
name = ele.name;
}
});
return name;
}, },
}, },
}; };
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<Button @click="complexSearch" type="primary" style="margin-left: 10px">查询</Button> <Button @click="complexSearch" type="primary" style="margin-left: 10px">查询</Button>
</div> </div>
</Modal> </Modal>
<Drawer title="列设置" v-if="set" v-model="config" :scrollable="true" placement="left" :mask="false"> <Drawer title="列设置" v-if="set" v-model="config" :scrollable="true" placement="left" :mask="false" class-name="tree-drawer">
<div slot="header"> <div slot="header">
列设置 列设置
<a @click="undoConfig" class="ml50"> <a @click="undoConfig" class="ml50">
......
...@@ -133,7 +133,7 @@ henq.toTree = (list, rootId, format, parentFiledName) => { ...@@ -133,7 +133,7 @@ henq.toTree = (list, rootId, format, parentFiledName) => {
function toTree(data, parentId, level) { function toTree(data, parentId, level) {
let parents = data.filter(u => { let parents = data.filter(u => {
if(u[upId]=='') if(u[upId]==='')
{ {
u[upId]=null u[upId]=null
} }
......
...@@ -26,6 +26,9 @@ export default { ...@@ -26,6 +26,9 @@ export default {
} }
}); });
}, },
batch(ids) {
return Api.post(`${material}/projectplan/batchdelete`,ids);
},
///projecttemplate/list ///projecttemplate/list
templates(params){ templates(params){
return Api.post(`${material}/projecttemplate/list`,params) return Api.post(`${material}/projecttemplate/list`,params)
......
<template> <template>
<div> <div>
<Card> <Card>
<EditGrid :columns="columns" ref="grid" :batch="true" :items="list" :level="8" :drag="true" :exportTitle="exportTl"> <EditGrid :columns="columns" ref="grid" :batch="true" :items="list" :level="8" :drag="true" :exportTitle="exportTl" @on-selection-change="batchChange">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"><Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" /> <FormItem prop="keys"><Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" />
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</template> </template>
<template slot="batch">
<Button type="primary" @click="bacthRemove()">批量删除</Button>
</template>
</EditGrid> </EditGrid>
</Card> </Card>
<Submenus :show="showStatu" :data="tempItems" :params="params"></Submenus> <Submenus :show="showStatu" :data="tempItems" :params="params"></Submenus>
...@@ -70,6 +73,7 @@ export default { ...@@ -70,6 +73,7 @@ export default {
data() { data() {
return { return {
entity: {}, entity: {},
batchItems:[],
row: {}, row: {},
action: Api.index, action: Api.index,
easySearch: { easySearch: {
...@@ -87,13 +91,15 @@ export default { ...@@ -87,13 +91,15 @@ export default {
key: "drag", key: "drag",
type: "drag", type: "drag",
width: 50, width: 50,
align: 'center' align: 'center',
title: '移动',
}, },
{ {
key: "upId", key: "upId",
width: 50, width: 50,
type: "selection", type: "selection",
align: 'center' align: 'center',
title: '选择',
}, },
{ {
key: "upTitle", key: "upTitle",
...@@ -463,6 +469,21 @@ export default { ...@@ -463,6 +469,21 @@ export default {
} }
]; ];
}, },
batchChange(items,list){
this.batchItems=items;
},
bacthRemove(){
var ids=this.batchItems.map(u=>{
return u.id;
})
if(ids.length>0){
Api.batch(ids).then(r=>{
if(r.success){
this.search();
}
})
}
},
//批量导入start //批量导入start
//导入功能 //导入功能
openModalIm() { openModalIm() {
......
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